[MDEV-3758] LP:1035271 - ruby dbi connection to Mariadb break after beeing idle for 10 minutes Created: 2012-08-10 Updated: 2012-10-04 Resolved: 2012-10-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | ||
| Reporter: | Hubert Krause (Inactive) | Assignee: | Unassigned |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
ruby dbi connection to Mariadb break after beeing idle for 10 minutes I use:
ruby dbi connection to Mariadb break after beeing idle for 10 minutes and doing #!/usr/bin/env ruby require 'dbi' DBNAME='test'
wait_min=[9,10,11] db = DBI.connect("DBI:Mysql:database=# {DBNAME};socket=# {DBSOCKET}", DBUSER, DBPASS) wait_min.each do | n | min." puts "Disconnect:" Waiting for 9 minutes and doing a 'SELECT 1;' works, waiting for 10 minutes lead to the error: /usr/lib/ruby/1.8/dbd/Mysql.rb:106:in `error': MySQL server has gone away (DBI::DatabaseError) An excerpt of an strace log running these program: connect(3, {sa_family=AF_FILE, path="/var/run/mysqld/mysqld.sock"}, 110) = 0 ) = 0 fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f489e3d4000 write(1, "2012-08-10T11:51:16+02:00\n", 26) = 26 write(1, "do query: SELECT 1;\n", 20) = 20 poll([{fd=3, events=POLLIN|POLLPRI}], 1, 0) = 0 (Timeout) write(3, "\n\0\0\0\3SELECT 1;", 14) = 14 read(3, "\1\0\0\1\1\27\0\0\2\3def\0\0\0\0011\0\f?\0\1\0\0\0\10\201\0\0\0\0"..., 16384) = 56 write(1, "sleep for 9 min.\n", 17) = 17 select(0, NULL, NULL, NULL, {540, 0}) = 0 (Timeout) stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2309, ...} ) = 0 write(3, "\n\0\0\0\3SELECT 1;", 14) = 14 read(3, "\1\0\0\1\1\27\0\0\2\3def\0\0\0\0011\0\f?\0\1\0\0\0\10\201\0\0\0\0"..., 16384) = 56 write(1, "sleep for 10 min.\n", 18) = 18 select(0, NULL, NULL, NULL, {600, 0}) = 0 (Timeout) stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2309, ...}) = 0 brk(0xe0a000) = 0xe0a000 brk(0xe05000) = 0xe05000 write(1, "2012-08-10T12:10:16+02:00\n", 26) = 26 write(1, "do query: SELECT 1;\n", 20) = 20 poll([{fd=3, events=POLLIN|POLLPRI} ], 1, 0) = 1 ([ {fd=3, revents=POLLIN|POLLHUP}]) , {0x7f489df4fd60, [], SA_RESTORER, 0x7f489dcabff0}, 8) = 0 I have tested this Program with mysqld 5.1.63 and it works as expected. The difference between mysqld 5.1.63 and The only workaround I can imagin is to do keep alive querys on idle connections. |
| Comments |
| Comment by Elena Stepanova [ 2012-08-12 ] |
|
Re: ruby dbi connection to Mariadb break after beeing idle for 10 minutes I ran your script on MariaDB 5.3.7 (my local installation from a binary tarball), and I didn't hit the issue, both 10 and 11 min work as expected. What you observe looks like you have wait_timeout=600 configured somewhere for your MariaDB instance (but not for MySQL). Could you please connect to your servers, both of them, and check the value of wait_timeout? SELECT @@global.wait_timeout; (It is important because the session timeout would be initialized differently). Thanks. |
| Comment by Rasmus Johansson (Inactive) [ 2012-08-15 ] |
|
Launchpad bug id: 1035271 |
| Comment by Hubert Krause (Inactive) [ 2012-08-15 ] |
|
Re: ruby dbi connection to Mariadb break after beeing idle for 10 minutes Sorry, I've send my reply with the wrong email adress, thats why it take so long. Now here my reply: I am Sorry for this wrong Bugreport because: > SELECT @@global.wait_timeout; gives 28800 on the mysql5.1 server and 600 on the mariadb server. If I But nevertheless it is a strange default in my.cnf for wait_timeout Thank you very much for your help, Hubert Krause |