Bug #118682 | connection_memory_limit and global_connection_memory_limit don't work | ||
---|---|---|---|
Submitted: | 18 Jul 3:52 | Modified: | 24 Jul 6:31 |
Reporter: | Xiaocong Ding (OCA) | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: Options | Severity: | S2 (Serious) |
Version: | 8.0, 8.0.42 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | OOM |
[18 Jul 3:52]
Xiaocong Ding
[18 Jul 13:30]
Frederic Descamps
Hello, Instead of using cgroup for this, as you do, have you tried using GLOBAL_CONNECTION_MEMORY_TRACKING? See https://dev.mysql.com/doc/refman/8.4/en/server-system-variables.html#sysvar_global_connect... SQL> set global global_connection_memory_tracking=1; SQL> set <global/session> connection_memory_limit=2200000; SQL> set global global_connection_memory_limit=536870912000;
[21 Jul 2:43]
Xiaocong Ding
Hello Frederic, Even if global_connection_memory_tracking is set, mysqld will still OOM. If the cgroup limit on 4G memory is removed, you can observe through top that the memory has risen to 8G, and the client will receive an deferred error: "ERROR 4082 (HY000) at line 8: Connection closed. Connection memory limit 2097152 bytes exceeded. Consumed 75166856 bytes." It can be seen that there is a huge delay in the effect of connection_memory_limit or global_connection_memory_limit. It usually fails to protect mysqld from OOM. Key parameters in my.cnf: ... connection_memory_limit=2097152 global_connection_memory_limit=16777216 global_connection_memory_tracking=ON ... Execute the following SQL and mysqld will still OOM under 4G cgroup limit: mysql -unormal -pabc1234! -h127.0.0.1 -P3306 -Dtestdb < ./huge_in_clause.sql
[21 Jul 2:55]
Xiaocong Ding
The sql which consumes huge memory
Attachment: huge_in_clause.sql (application/octet-stream, text), 42.58 MiB.
[24 Jul 6:31]
MySQL Verification Team
Hello Xiaocong Ding, Thank you for the report and feedback. regards, Umesh