What caused the counter-revolutionary wave of 1989?

I know things were really bad in 1989, but what made it so bad that people in so many socialist countries just rose up and overthrew their own governments?