When I run rake db:migrate I get this error at the end.
Error in my_thread_global_end(): 1 threads didn't exit
I pinned it down to this code in one of my migration files.
# create admin user user = User.new user.login = 'admin' user.password = 'password' user.save(false)
If I don’t run user.save(false) I don’t get the error. I am not sure why, the user does get saved properly to the database.
I saw this post on the MySQL forums that seemed to indicate it was an issue with libmySQL.dll. So I upgraded my MySQL instance from 5.0.27 to 5.0.51a. Of course this did not go smoothly, I got this error when trying to reconfigure the MySQL server instance “MySQL service could not be started error 0″. Fortunately another post on the MySQL forums, Could not start service : Error 2003, solved this problem for me. I just had to remove the following files from the mysql/data directory.
Unfortunately when I then did a rake db:migrate I saw this error.
Mysql::Error: Table 'prayer.schema_info' doesn't exist: SELECT version FROM schema_info
After deleting and recreating the database I was finally able to run rake db:migrate. Unfortunately I still got the same error that inspired this post.
Googling some more I saw a MySQL bug report, MySQL Bugs: #25621: Error in my_thread_global_end(): 1 threads didn’t exit. Apparently this is a client side issue and I think I can safely ignore it though it is quite annoying.
Strictly speaking, this is not MySQL bug. This is a client bug – a client application (PHP, probably) linked with libmysqlclient calls my_thread_init() but does not call my_thread_end() as appropriate (doesn’t call at all or calls too late). MySQL client library detects this and issues a warning.
On the other hand, we can just remove the check and let buggy applications to fail some other way. Not calling my_thread_end() is a guaranteed memory leak. Calling it too late could easily crash the application.