500 Internal Server Error

Troubleshooting the Infamous 500 Internal Server Error
Perhaps no other error gives webmasters more nightmares than the 500 Internal Server Error. Probably because the message is so ambiguous and the root causes so myriad that troubleshooting them is a black-art to some. Perhaps this page can alleviate some of that FUD by listing common causes for various applications available in the DreamHost hosting packages.

FlySpray
When trying to run search queries in our bug/feature request tracker (Flyspray), we were running into "500: Internal Server Error" on a pretty regular basis, although it would appear inconsistently (sometimes a refresh would cause the search to go through, sometimes it wouldn't). DreamHost customer support took a look at our mySQL database and found some inefficient queries that seemed to be the source of the trouble.

After a great deal of banging our heads against the wall, we eventually narrowed down the cause - we had modified our Flyspray installation to allow expanded tracking of votes on each feature request. The default installation only allows one vote per feature request per user, but we needed to be able to increment and decrement the votes arbitrarily. What was happening was each vote was being recorded as a separate entry in the database, so every time a search was performed, each search result would query the table of votes to find out how many were assigned to it. I guess our votes table just grew too large and started bogging things down (there were nearly 6k votes, and only about 3k mod to track the votes using a field in the main task table, instead of recording a new table row for each vote. Flyspray runs much faster now, and we haven't run into any further 500 errors since.

I hope this comes in handy for other users who may encounter the dreaded 500, most generic of all server errors!