Comments - Migrating from MySql: MariaDB server closing client connections unexpectedly
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.
You might be running into wait_timeout (http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_wait_timeout).
Increasing that, rather than interactive_timeout might help. MariaDB does not close client connections just for the fun of it, there is always a reason (of those reasons, there are not many - client closes connection, or timeout, or kill)
Thanks for the suggestion. I hadn't thought of setting the parameter 'wait_timeout' separately. Will give that a try also and post the result after a couple of days.
But even then my doubt remains. The same setup with the same 'my.cnf' file runs perfectly fine if I remove MariaDB and reinstall MySql server. We have been using MySql for several years now and all the parameters are fine tuned. So I am a bit apprehensive of playing around with the configurations and I expect the same configurations to work well.
Is there any difference of behavior or any additional functionality in MariaDB related to this? Is there any additional configuration file that MariaDB reads?
You can compare output of "show variables" with both MariaDB and MySQL to find the difference in variables.
I'm not aware of any differences in my.cnf search logic, but you can start mysqld under strace to really find it out.
You do not have to change my.cnf, because you can set session variables in the connection URL (using documented sessionVariables parameter)
If you're looking for the source of the difference, are you really-really sure it is caused by the server and not by the driver (since some parameters like clientInteractive are not supported MAriaDB JDBC)?
Finally, if you really want to know about aborted connections, set log_warnings=2.
I tried to set the parameter 'wait_timeout' exclusively but the value was not reflecting in the output of 'show variables'. I tried to set it dynamically using the commands - 'set wait_timeout=57600;', 'set @@GLOBAL.wait_timeout=57600;' and also in the '/etc/my.cnf' file but none them worked. Still the default value of '28800' was being used.
Finally when I set the 'interactive_timeout' to 57600 the same value was reflected in 'wait_timeout'.
In addition to that I added the parameter 'autoReconnect=true' in the connection URL of DBCP.
After running the applications for about a day again the exceptions appeared again.
I tried searching the Mariadb logs in '/var/log/mysqld.log' for information related to aborted connections, but couldn't find anything there. Is there any other file where this information is printed?
you should not set global wait timeout, it will affect the timeout in the connection started after you current one.
Instead, you should set wait_timeout for your JDBC connection, with "set wait_timeout=57600"
You can test if this was correctly set with "select @@wait_timeout" (please, do this from the same connection). This is essential. If you change my.cnf, you need to restart the server
you need to set log_warnings=2, and look in your error log file. The path of the error log file is the value of the "log_error" variable.
We are using Hibernate so haven't come across any configuration to set wait_timeout for the connection. I'll check again. And for the moment it is ok to restart the DB as this is just the development environment.
Hibernate supports connection url. Connection url can have
"sessionVariables=wait_timeout=1000000" in the URL query string