Aborted Connections / Error reading communication packets

Aborted Connections / Error reading communication packets

Postby LarsOberg » Sun 28 Feb 2010 02:57

Hello,

I am trying to handle a problem with "Lost Connection to MySQL Server during query." As part of this, I have increased the log level of the server to get more info on what causes abrupt connection terminations. I am now getting a ton of messages like "Aborted connection 783034 to db: 'Sales' user: 'cho' host: '192.168.1.10' (Got an error reading communication packets)" in the log file. There are literally thousands of such messages in only a few days.

I believe this is due to connection pooling, so I did some testing and the messages seem to enter the log file whenever an application exits. But I cannot turn pooling off for performance reasons. So I tried MySqlConnection.ClearAllPools() when exiting the app. That did not help since it does not actually clear the connections for about 30 seconds. If I call ClearAllPools and then wait for more than 30 seconds, the app exits just fine without any "Aborted connection" entries in the log file.

Is there any way to make the pool properly close all connections upon exit of the app? Maybe adding a ClearAllPoolsImmediately() method (that blocks until done, which should not take long)?

Once this huge number of messages no longer clutter the error log, it will be much easier to see other, more important messages.

I have another question relating to "Lost Connection to MySQL Server during query" that I will post separately.

Thanks,
Lars
LarsOberg
 
Posts: 41
Joined: Tue 11 Oct 2005 18:45

Postby Shalex » Mon 01 Mar 2010 15:02

We will consider the possibility of implementing such method. Currently,

I cannot reproduce the mentioned "Aborted connection" messages in the log file of MySQL Server. I added this entry to the my.ini file of MySQL Server v 5.1.39:
Code: Select all
general_log=1
general_log_file="D:/Program Files/MySQL/MySQL Server 5.1/Log.txt"

Then I executed the following code:
Code: Select all
class Program {
    void CreateConnectionsInPool() {
        string connStr = "host=localhost;uid=root;pwd=root;";
        using (MySqlConnection conn1 = new MySqlConnection(connStr)) {
            conn1.Open();
            using (MySqlConnection conn2 = new MySqlConnection(connStr)) {
                conn2.Open();
            }
        }

    }
    static void Main(string[] args) {
        MySqlMonitor monitor = new MySqlMonitor(){IsActive = true};
        Program prog = new Program();
        prog.CreateConnectionsInPool();
        MySqlConnection.ClearAllPools();
    }
}

Log.txt contains no "Aborted connection" messages. I have tried the 5.70.97 version of dotConnect for MySQL.
Please give us the following information:
1) your MySQL server version;
2) settings you have made in the my.ini file to enable the detailed logging with the "Aborted connection" messages;
3) how should I modify the code snippet to reproduce your scenario with errors in the log file.
Shalex
Devart Team
 
Posts: 7705
Joined: Thu 14 Aug 2008 12:44

Postby LarsOberg » Mon 01 Mar 2010 16:03

Try setting "log-warnings=2" in my.cnf. The messages appear in the error log, not the general log.

I am using MySQL Server 5.1.40 on CentOS, but I do not thing the MySQL version is relevant - it happens with earlier versions as well.

Lars
LarsOberg
 
Posts: 41
Joined: Tue 11 Oct 2005 18:45

Postby Shalex » Tue 02 Mar 2010 13:16

We have reproduced the issue. We will investigate it and notify you about the results as soon as possible.
Shalex
Devart Team
 
Posts: 7705
Joined: Thu 14 Aug 2008 12:44

Postby Shalex » Thu 04 Mar 2010 17:24

As you mentioned above, these errors occur because connections from the pool are not closed but aborted upon exit of the application. We have implemented the MySqlConnection.ClearAllPools(bool force) method. If force=true, all pools will be cleaned without timeout. Using force=true is equal to MySqlConnection.ClearAllPools() without parameter. This functionality will be included in the next build. I will post here when it is available.
Shalex
Devart Team
 
Posts: 7705
Joined: Thu 14 Aug 2008 12:44

Postby LarsOberg » Mon 08 Mar 2010 21:18

Great. Thanks!
LarsOberg
 
Posts: 41
Joined: Tue 11 Oct 2005 18:45

Postby Shalex » Thu 01 Apr 2010 07:53

dotConnect for MySQL v 5.70 is released!
It can be downloaded from http://www.devart.com/dotconnect/mysql/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://www.devart.com/forums/viewtopic.php?p=55120 .
Shalex
Devart Team
 
Posts: 7705
Joined: Thu 14 Aug 2008 12:44


Return to dotConnect for MySQL