According to wikipedia on Pessimism and Pragmatic Criticism
...Al-Ghazali and William James rejected their pessimism after suffering psychological, or even psychosomatic illness...
Other authors such as Socrates, Diogenes, David Hume, William James and a large etc. had several kinds of mental troubles. Nietzsche was seriously depressed during his nihilistic period and it's very well-known for philosophers to have periods of severe depression during existential doubts.
In some other cases philosophy has had a very positive psychological outcome because it has been providing people with wisdom and knowledge and different visions and approaches to certain topics such as religion, nationalism, materialism, ethics, morality, human nature, beauty, truth etc.
Are there any books in psychology, philosophy or neuroscience who talk about why negative or obsessive thinking is bad for your mental health? What makes for instance pessimism be bad for your mental heath? Are there any explanation for this apart for spiritual theories in some religions? Are we genetically predetermined to think in an specific way because otherwise we could end up mentally sick? Is it just the habit of over-thinking what is unhealthy and we should learn to stop the mind from time to time like in Buddhism? Is it perhaps not the idea but the emotion attached to it that brings discomfort? If so why the pessimist philosophers mentioned above and other philosophers had to quit or evolve their philosophies to overcome their mind discomfort?
Are there any guides or tutorials which warn us about the dangers of philosophy or give us advice on how to think before we start investing time and effort with hard philosophical mind-jobs?
"Your worst enemy cannot harm you as much as your own unguarded thoughts." Buddha