Monday, November 11, 2013

Why is mysql_library_end() so slow?


Why is mysql_library_end() soooooo sloooooow?

Under certain conditions it seems mysql_library_end() takes about 5 seconds to complete. Under other scenarios it only takes milliseconds. The latter being the expected, in all honesty.

Why, you ask?

I cannot really tell you why because I haven't dug into the source, but in my case the root cause turned out to be missing call(s) to mysql_thread_end() prior to thread exit from every(!) thread that had initialized a MYSQL struct. Fix that, and v\oila, milliseconds execution from mysql_library_end().