However, I do remember that, during my PhD, about a third of my lab mates had some kind of mental breakdown. Some suddenly cut the bridge and stopped going to the lab. They would not answer to emails or phone calls.
I would say that in the CS fields, successful PhD are most often a very positive experience, and bring a lot of professional opportunities. The program itself is very intellectually satisfying. And now, many of lab mates have very exciting jobs: startup founders, top AI scientists/engineers, professors.
However,some students that were used to study very well and have top grades, once they started their PhD program, felt completely lost and hopeless in this totally different way of working and thinking. They had to work (mainly) alone for years. So, if no output came out, they felt very depressed. On top of that, the failure to publish usually extends the length of the PhD program...