I am using a MySQL 5.6 DB with MyISAM tables under FreeBSD 8.3. The main part of code is in PHP, but the problem arises, when I launch the self-written on C++ chat-server. I use the mysql.h for DB connections and libwebsockets for both HTTP and websockets interaction. The previous version was written in C, no locks happened. The chat server has a websocket regime and the refresh regime. It also uses the database for user authentication and loading/saving of settings.
Now when I run this server, after a certain period, the database gets flooded with connections with different queries, all with the status "Waiting for table metadata lock". When I kill the chat, the queries start being processed.
I am 100% sure, there are no ALTER TABLE, CREATE TABLE or similar queries being executed at any time, so they are not the reason.
So I don't understand what in this situation may be the reason for database to hang, and how can I trace and solve it. I would appreciate any help or ideas! Thanks ahead!