Comments - Migrating from MySql: MariaDB server closing client connections unexpectedly

11 years, 2 months ago Vladislav Vaintroub

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.

 
11 years, 2 months ago Vivek Kubaji

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?

 
11 years, 2 months ago Vladislav Vaintroub

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.

 
11 years, 2 months ago Vivek Kubaji

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.

 
11 years, 2 months ago Vladislav Vaintroub

Hibernate supports connection url. Connection url can have

"sessionVariables=wait_timeout=1000000" in the URL query string

 
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.