Phase transitions and avalanches in synchronizing systems