intermittent "Lost connection to MySQL server" errors w/ DBI

intermittent "Lost connection to MySQL server" errors w/ DBI

am 29.09.2004 20:58:20 von Ed Korthof

Hi --

I spent some time searching for any reports like this, but didn't find
anything which looks like it's the same issue.

One only one of our machines (others seem fine) we're getting
intermittent failures to connect in a system monitoring process. This
happens on a regular basis during periods of low load; it is easily
reproducible on that one machine by stress testing with lots of clients.
It is not reproducible on other machines (so far, anyway).

The error looks like:

$ ./mysql_running
Lost connection to MySQL server during query at ./mysql_running line 33.

The relevant perl script looks like this:

$SIG{ALRM} = sub { die "Database connection timed out\n";};
alarm($timeout);
my $dbh = DBI->connect("dbi:mysql:;host=$database_host;port=$database_ port",
$username,
$password,
{PrintError=>0});

$dbh or die $DBI::errstr;

On another machine, when I simulate high load, MySQL can't keep up and we
get the expected error --

$ ./mysql_running
Database connection timed out

So -- I've tried strace. Here's a sample where things worked:

26093 connect(3, {sa_family=AF_UNIX, path="/var/lib/mysql/mysql.sock"}, 110) = 0
[snip]
26093 setsockopt(3, SOL_IP, IP_TOS, [8], 4) = -1 EOPNOTSUPP (Operation not supported)
26093 setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
26093 read(3, "0\0\0\0", 4) = 4
26093 read(3, "\n4.0.15-standard\0\30\t\0\0QIXa]1x,\0, "..., 48) = 48
26093 open("/usr/share/mysql/charsets/Index", O_RDONLY|O_LARGEFILE) = 4
26093 fstat64(4, {st_mode=S_IFREG|0755, st_size=621, ...}) = 0
26093 old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4013d000
26093 read(4, "# sql/share/charsets/Index\n#\n# T"..., 4096) = 621
[snip]
26093 read(4, "", 4096) = 0
26093 close(4) = 0
26093 munmap(0x4013d000, 4096) = 0
26093 write(3, "\34\0\0\1\205 \0\0\0{username}{password}...", 32) = 32
26093 read(3, "\5\0\0\2", 4) = 4

And here's a sample where they didn't:

26096 connect(3, {sa_family=AF_UNIX, path="/var/lib/mysql/mysql.sock"}, 110) = 0
[snip]
26096 setsockopt(3, SOL_IP, IP_TOS, [8], 4) = -1 EOPNOTSUPP (Operation not supported)
26096 setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
26096 read(3, "0\0\0\0", 4) = 4
26096 read(3, "\n4.0.15-standard\0\37\t\0\0\"MA 26096 open("/usr/share/mysql/charsets/Index", O_RDONLY|O_LARGEFILE) = 4
26096 fstat64(4, {st_mode=S_IFREG|0755, st_size=621, ...}) = 0
26096 old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x4013d000
26096 read(4, "# sql/share/charsets/Index\n#\n# T"..., 4096) = 621
[snip]
26096 read(4, "", 4096) = 0
26096 close(4) = 0
26096 munmap(0x4013d000, 4096) = 0
26096 write(3, "\34\0\0\1\205 \0\0\0{username}{password}", 32) = -1 EPIPE (Broken pipe)
26096 --- SIGPIPE (Broken pipe) @ 0 (0) ---
26096 shutdown(3, 2 /* send and receive */) = 0

(the next process had no trouble.)

The networking configuration is correct; the connections usually work
fine; the queries are simple. There's nothing whatsoever in our error
logs about the failures; turning on query logging doesn't show anything
interesting. Our my.cnf looks like this:

[mysqld]
set-variable=max_allowed_packet=10485760
set-variable=max_connections=355

Any suggestions for else I can look at?

thanks --

Ed
--
+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=
| Ed Korthof | edk@collab.net | 650-228-2527 |
+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=+=-=

--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org

RE: intermittent "Lost connection to MySQL server" errors w/ DBI

am 21.10.2004 01:59:50 von miguel solorzano

Hi,

Unlucky we don't have enough information for to create a repeatable test case for this
bug report. If you can provide us a repeatable test case please open a bug report in our
Bug System at:

http://bugs.mysql.com

Regards,
Miguel

------------------------------------------------------------ ---------------

Hi --

I spent some time searching for any reports like this, but didn't find
anything which looks like it's the same issue.

One only one of our machines (others seem fine) we're getting
intermittent failures to connect in a system monitoring process. This
happens on a regular basis during periods of low load; it is easily
reproducible on that one machine by stress testing with lots of clients.
It is not reproducible on other machines (so far, anyway).

The error looks like:

$ ./mysql_running
Lost connection to MySQL server during query at ./mysql_running line 33.

The relevant perl script looks like this:

$SIG{ALRM} = sub { die "Database connection timed out\n";};
alarm($timeout);
my $dbh = DBI->connect("dbi:mysql:;host=$database_host;port=$database_ port",
$username,
$password,
{PrintError=>0});

$dbh or die $DBI::errstr;

On another machine, when I simulate high load, MySQL can't keep up and we
get the expected error --

$ ./mysql_running
Database connection timed out

So -- I've tried strace. Here's a sample where things worked:

26093 connect(3, {sa_family=AF_UNIX, path="/var/lib/mysql/mysql.sock"}, 110) = 0
[snip]
26093 setsockopt(3, SOL_IP, IP_TOS, [8], 4) = -1 EOPNOTSUPP (Operation not supported)
26093 setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
26093 read(3, "0\0\0\0", 4) = 4
26093 read(3, "\n4.0.15-standard\0\30\t\0\0QIXa]1x,\0, "..., 48) = 48
26093 open("/usr/share/mysql/charsets/Index", O_RDONLY|O_LARGEFILE) = 4
26093 fstat64(4, {st_mode=S_IFREG|0755, st_size=621, ...}) = 0
26093 old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x4013d000
26093 read(4, "# sql/share/charsets/Index\n#\n# T"..., 4096) = 621
[snip]
26093 read(4, "", 4096) = 0
26093 close(4) = 0
26093 munmap(0x4013d000, 4096) = 0
26093 write(3, "\34\0\0\1\205 \0\0\0{username}{password}...", 32) = 32
26093 read(3, "\5\0\0\2", 4) = 4

And here's a sample where they didn't:

26096 connect(3, {sa_family=AF_UNIX, path="/var/lib/mysql/mysql.sock"}, 110) = 0
[snip]
26096 setsockopt(3, SOL_IP, IP_TOS, [8], 4) = -1 EOPNOTSUPP (Operation not supported)
26096 setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
26096 read(3, "0\0\0\0", 4) = 4
26096 read(3, "\n4.0.15-standard\0\37\t\0\0\"MA 26096 open("/usr/share/mysql/charsets/Index", O_RDONLY|O_LARGEFILE) = 4
26096 fstat64(4, {st_mode=S_IFREG|0755, st_size=621, ...}) = 0
26096 old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x4013d000
26096 read(4, "# sql/share/charsets/Index\n#\n# T"..., 4096) = 621
[snip]
26096 read(4, "", 4096) = 0
26096 close(4) = 0
26096 munmap(0x4013d000, 4096) = 0
26096 write(3, "\34\0\0\1\205 \0\0\0{username}{password}", 32) = -1 EPIPE (Broken pipe)
26096 --- SIGPIPE (Broken pipe) @ 0 (0) ---
26096 shutdown(3, 2 /* send and receive */) = 0

(the next process had no trouble.)

The networking configuration is correct; the connections usually work
fine; the queries are simple. There's nothing whatsoever in our error
logs about the failures; turning on query logging doesn't show anything
interesting. Our my.cnf looks like this:

[mysqld]
set-variable=max_allowed_packet=10485760
set-variable=max_connections=355

Any suggestions for else I can look at?

thanks --

Ed
------------------------------------------------------------ ---------------


--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/bugs?unsub=gcdmb-bugs@m.gmane.org