[MDEV-24471] Connection aborts is happening in MariaDB 10.2 but not in 10.1 even with log_warnings level set to 2 Created: 2020-12-22  Updated: 2021-04-25  Resolved: 2021-04-25

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.2.29
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Ragul Assignee: Unassigned
Resolution: Incomplete Votes: 0
Labels: need_feedback


 Description   

I am noticing different behavior in mariadb 10.1 & 10.2 reg.connection aborts.

I noticed connection getting aborted after 7 minutes(wait_timeout) of any query execution. There are few random connection aborts happening in my application too. But I don't see this behavior(connection abort logs) happening in mariadb 10.1.

I am aware that the default value for variable "log_warnings" has been changed from 1 to 2 in MariaDB 10.2. But even with log_warnings value as 2 in MariaDB 10.1, I don't see connection aborts happening.

For eg. In below query connection Id : 2218 is created

MariaDB [dummy]> show global variables like '%log%';
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    2218
Current database: dummy

From general query logs, the query executed time is 11:53:15

201222 11:53:15     6 Query     SHOW MASTER STATUS
                    6 Query     SHOW SLAVE STATUS
                    6 Query     UPDATE `oam`.`heartbeat` SET ts='2020-12-22T11:53:15.000830', file='mariadb-bin.000001', position='58352014', relay_master_log_file=NULL, exec_master_log_pos=NULL WHERE server_id='1'
                 2218 Connect   root@localhost as anonymous on dummy
                 2218 Query     show databases
                 2218 Query     show tables
                 2218 Field List        mytable
                 2218 Query     show global variables like '%wait%'

From Error logs, the connection closed at 12:00:16

2020-12-22 12:00:16 140673402672896 [Warning] Aborted connection 2218 to db: 'dummy' user: 'root' host: 'localhost' (Got timeout reading communication packets)

wait_timeout is set to 7mins(420s)

MariaDB [dummy]> show global variables like 'wait_timeout%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout  | 420   |
+---------------+-------+
1 row in set (0.01 sec)

I could see the same behavior happening for any query execution (Connection aborting after 7mins) in MariaDB 10.2 but it is not happening in 10.1 even when the log_warnings level set to 2



 Comments   
Comment by Alice Sherepa [ 2020-12-22 ]

Maybe you need to change max_allowed_packet/max_connections/thread_cache_size/interactive_timeout.
There are numerous possible reasons for these errors (https://dev.mysql.com/doc/refman/5.6/en/communication-errors.html)

Comment by Ragul [ 2020-12-22 ]

I have configured the same values for the mentioned variables in both versions.

| max_allowed_packet  | 33554432   |
| max_connections       | 516   |
| thread_cache_size      | 256   |
| interactive_timeout    | 420   |

Also, all the connection aborts are happening with respect to one reason only Got timeout reading communication packets.
As you can see in the above logs, these aborts are happening exactly after 7 mins (12:00:16 - 11:53:15).

This is the case for all the connection aborts. This matches with our wait_timeout value 420s.

Comment by Ragul [ 2021-02-08 ]

Any hints to find why the above logs are occurring?

Comment by Elena Stepanova [ 2021-03-28 ]

RagulR,

Could you please clarify, what is not happening on 10.1 – the connection abort after wait_timeout period, or the logging warning upon abort?

The warning indicates that the configured timeout has been invoked, and from what you have pasted, 10.2 behaves as expected. You configure the interactive timeout to be 7 minutes, your connection disconnects after 7 minutes. In fact, you don't even need to run any query for it, just watch the error log – it will write the warning when the timeout occurs. The error on the next query is just an aftermath of the previous connection closing.

I am getting the same on 10.1.48 as well.

Generated at Thu Feb 08 09:30:14 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.