1

Currently, I am working on a project to integrate mysql with the IOCP server to collect sensor data and verify the collected data from the client.

However, there is a situation where mysql misses a connection.

The query itself is a simple query that inserts a single row of records or gets the average value between date intervals.

The data of each sensor flows into the DB at the same time every 5 seconds. When the messages of the sensors come on occasionally or overlap with the message of the client, the connection is disconnected.

lost connection to mysql server during query

In relation to throwing the above message

max_allowed_packet Numbers changed. interactive_timeout, net_read_timeout, net_write_timeout, wait_timeout

It seems that if there are overlapping queries, an error occurs.

Please let me know if you know the solution.

teeyo
  • 3,665
  • 3
  • 22
  • 37
jm Park
  • 11
  • 2

2 Answers2

1

I had a similar issue in a MySQL server with very simple queries where the number of concurrent queries were high. I had to disable the query cache to solve the issue. You could try disabling the query cache using following statements.

SET GLOBAL query_cache_size = 0;
SET GLOBAL query_cache_type = 0;

Please note that a server restart will enable the query cache again. Please put the configuration in MySQL configuration file if you need to have it preserved.

charitha
  • 361
  • 3
  • 9
0

Can you run below command and check the current timeouts?

SHOW VARIABLES LIKE '%timeout';

You can change the timeout, if needed -

SET GLOBAL <timeout_variable>=<value>;
Anand Mattikopp
  • 332
  • 2
  • 11
  • connect_timeout 10 delayed_insert_timeout 300 have_statement_timeout YES innodb_flush_log_at_timeout 1 innodb_lock_wait_timeout 50 innodb_rollback_on_timeout OFF interactive_timeout 4147200 lock_wait_timeout 31536000 net_read_timeout 120 net_write_timeout 120 rpl_stop_slave_timeout 31536000 slave_net_timeout 60 wait_timeout 4147200 I change that – jm Park Nov 07 '17 at 23:58
  • How much time are your queries taking? Change the connection timeout to accordingly e.g For changing it to 60 seconds, SET GLOBAL connect_timeout=60; – Anand Mattikopp Nov 08 '17 at 06:09