Score:0

Mysql query string too long

za flag

I'm experiencing a strange mysql behaviour that occurs between two virtual machines.

When I have a query string longer than 1457 chars, the connection I'm using hangs.
I was thinking the problem was a query with a tons of result but then discovered that the query string is not important.

For example:

select * from users where uname = "abcdefffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffpooooooooooppppppppfooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooffffffseroieeeeuuwwwwwwwwwwwuii";

hangs the server.

If i remove a single char from that string, mysql returns an empty recordset, as expected. There is not a such user and the field uname is varchar(64). The table, contains just one record.

I tried to monitor the socket and discovered that the querystring is retransmitted 20 times and then the traffic stops but the client does not exit and connection is not dropped/closed.cd

192.168.0.111:43012 -> 192.168.0.112:mysql
    ...
    bytes_sent:22614
    bytes_retrans:20260
    bytes_acked:329
    bytes_received:8208
    segs_out:28
    segs_in:10
    data_segs_out:18
    data_segs_in:8
    ...

The very same query made from a different instance to the same server, works flawlessy. I tried the official mysql terminal client, an alternative terminal client and a script but I got the same result.

ua flag
File a bug report with a concrete example at bugs.mysql.com
us flag
This could be an issue with MTU setting on the network interfaces on the host. Might be that the query ends up in a too long TCP segment, which is then dropped by the kernel.
Eineki avatar
za flag
Thanks for the suggestion @RickJames. It is difficult to file a bug report. The problem is limited to a single server vm when it interacts with a specific vm client. I replicated the two vms and the problem gone away. I Rebooted the two original vms and the problem persists. If just one of the two machines change, the problem will not occurs.
ua flag
@Eineki - Thanks for trying. "client" -- mysql commandline client? Or something else?
Eineki avatar
za flag
Yes, @RickJames mysql command line client, mycli, an alternative commandline client written in python and a very simple php script (connect, send the query, retrieve the empty recordset and close connection) written on purpose. Same result. I'm starting to think of the mtu as #TeroKilkanen pointed out (the string lenght should have set that bell ringing).
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.