Bug #73897 max_statement_time (memory/sql/thd_timer) leaks memory
Submitted: 11 Sep 2014 17:59 Modified: 12 Nov 2014 22:52
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Options Severity:S1 (Critical)
Version:5.7.6 OS:Windows
Assigned to: CPU Architecture:Any
Tags: Leak, max_statement_time, memory leak

[11 Sep 2014 17:59] Shane Bester
Description:
Using session variable max_statement_time leaks memory on windows.

How to repeat:
set session max_statement_time= 1;
select 1;

Run the above at high speed (e.g. 100000 time per second) and watch memory dwindle. 

Can monitor it scientifically also like this:

------
update performance_schema.setup_instruments set enabled='no',timed='no';
update performance_schema.setup_instruments set enabled='yes',timed='yes' 
where name like 'memory/sql/thd_timer';

update performance_schema.setup_consumers set enabled='no';
update performance_schema.setup_consumers set enabled='yes' 
where name not like '%digest%';

select event_name,current_number_of_bytes_used,current_count_used 
from performance_schema.memory_summary_global_by_event_name 
where event_name = 'memory/sql/thd_timer';
--------
[11 Sep 2014 18:09] MySQL Verification Team
How to:

mysqlslap.exe -hlocalhost --number-of-queries=10000000000 --query="set max_statement_time=1;select 1;" --iterations=10000 --create-schema=test
[12 Nov 2014 22:52] Paul DuBois
Noted in 5.7.6 changelog.

On Windows, setting the max_statement_time session variable greater
than 0 resulted in a memory leak.