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
Aborted Connections / Error reading communication packets
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:
Then I executed the following code:
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.
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"
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();
}
}
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.
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.
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 .
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 .