So how to track down the reason of mysterious 500 errors? Well, we did some debugging and were finally able to reproduce the issue on development environment. One of our commits contained premature optimization. There was a decision to save some memory by running a piece of code under specific circumstances only. To be more precise, when the user is signed in. But the condition was added too early. Basically, part of the code, which responsible for cleaning user's session was not yet initialized. Thus, all the requests which were coming from users with expired session triggered that mechanism. But as long as it was not initialized the error was thrown. The issue was solved by moving the condition a little after all of the base initializations are done.
Optimizations always bust things, because all optimizations are, in the long haul, a form of cheating, and cheaters eventually get caught © Larry Wall
That's a good lesson to learn. Premature optimizations should be avoided as much as possible.
We would like to say sorry to all of our users who had bad experience with visiting the Kukuruku Hub in a last few days. We'll try to do our best and keep the website available with 99.9% uptime!
6 comments
Premature optimization is the root of all evil (or at least most of it) in programming.But in your case seems that it wasn't a premature optimization in an usual meaning of the phrase, just inattention.
P.S. Editing comments is a real pain. We'll add it to our backlog. Thanks for pointing that out.
Upload image