Bug #91362 Incorrect query results under certain conditions.
Submitted: 21 Jun 2018 15:18 Modified: 22 Jun 2018 4:45
Reporter: Mark Schuart Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Optimizer Severity:S1 (Critical)
Version:5.6.36 - 5.6.40 and 5.7.18 - 5.7.22, 5.6.40, 5.7.22 OS:Any
Assigned to: CPU Architecture:Any

[21 Jun 2018 15:18] Mark Schuart
Description:
After a large number of DML statements, immediately followed by simple DQL statements, these DQLs sometimes return incorrect results.

If the DQL statements are repeated after a certain waiting time without further changes to the DB, the correct result is obtained.
This error can be reproduced in the following versions:
5.6.36 - 5.6.40 and
5.7.18 - 5.7.22

Earlier versions and the 5.5 branch do not seem to be affected.

Since I don't know the cause and it seems random depending on the system speed, I classify this bug as critical.

How to repeat:
Since the error only occurs after a sufficient number of statements, only the principle is described here.   

The genFiles.sh script creates a series of SQL test scripts.

If these are executed immediately one after the other against an existing database called "test", the following output or something similar can be obtained:

# mysql -D test < step1.sql; mysql -D test < step2a.sql; mysql -D test < step2b.sql; mysql -BND test < step3ff.sql;
2000
1
2000
1
2000
1
2000
1
2000
1
2000
1
2000
1
2000
1
2000
1
2000
1
2000
1
2000
1

However, the output is incorrect. The correct result is obtained after a short wait and executing the last SQL script again:

# mysql -BND test < step3ff.sql;
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000
2000

runSimple.sh and runSimple.bat are available for easy execution of these SQL scripts. They should work directly if no DB password is set for root.

What happens in detail (partly shortened):

step1.sql is used to prepare the database. It creates the necessary tables, inserts 9 lines in table "tf" and 2000 lines per line of table "tf" in table "tm". "tm.fid" refers to "tf.id" in later queries. "tm.ts" is always 1 and "tm.te" is always 999999990.

*** begin of shortened step1.sql ***

CREATE TABLE IF NOT EXISTS tf (
  id int(10) unsigned NOT NULL AUTO_INCREMENT,
  sid int(10) unsigned NOT NULL DEFAULT '0',
  tp char(10) NOT NULL DEFAULT '0',
  fn varchar(50) NOT NULL DEFAULT '0',
  PRIMARY KEY (id),
  UNIQUE KEY uni (sid,fn),
  KEY sid (sid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

CREATE TABLE IF NOT EXISTS tm (
  id int(10) unsigned NOT NULL AUTO_INCREMENT,
  fid int(10) unsigned NOT NULL DEFAULT '0',
  ts int(10) unsigned NOT NULL DEFAULT '999999999',
  te int(10) unsigned NOT NULL DEFAULT '999999999',
  sc varchar(50) NOT NULL DEFAULT '0',
  ky varchar(50) NOT NULL DEFAULT '0',
  PRIMARY KEY (id),
  UNIQUE KEY uni (fid,te,ts,sc,ky),
  KEY ts (ts),
  KEY te (te)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

INSERT INTO tf (id, sid, tp, fn) VALUES(1001, 302, '29278', 'fn1');
INSERT IGNORE INTO tm (id, fid, ts, te, sc, ky) VALUES
   (7654322, 1001, 1, 999999990, 'sc1001', 'ky7654322'),
	-- shortened
   (7658321, 1002, 1, 999999990, 'sc1002', 'ky7658321');
INSERT INTO tf (id, sid, tp, fn) VALUES(1003, 302, '26984', 'fn3');
INSERT IGNORE INTO tm (id, fid, ts, te, sc, ky) VALUES
   (7658322, 1003, 1, 999999990, 'sc1003', 'ky7658322'),
	-- shortened
   (7660321, 1003, 1, 999999990, 'sc1003', 'ky7660321');
INSERT INTO tf (id, sid, tp, fn) VALUES(1004, 302, '29099', 'fn4');
INSERT IGNORE INTO tm (id, fid, ts, te, sc, ky) VALUES
   (7660322, 1004, 1, 999999990, 'sc1004', 'ky7660322'),
	-- shortened
   (7662321, 1004, 1, 999999990, 'sc1004', 'ky7662321');
INSERT INTO tf (id, sid, tp, fn) VALUES(1005, 302, '13220', 'fn5');
INSERT IGNORE INTO tm (id, fid, ts, te, sc, ky) VALUES
   (7662322, 1005, 1, 999999990, 'sc1005', 'ky7662322'),
	-- shortened
   (7664321, 1005, 1, 999999990, 'sc1005', 'ky7664321');
INSERT INTO tf (id, sid, tp, fn) VALUES(1006, 302, '28202', 'fn6');
INSERT IGNORE INTO tm (id, fid, ts, te, sc, ky) VALUES
   (7664322, 1006, 1, 999999990, 'sc1006', 'ky7664322'),
	-- shortened
   (7666321, 1006, 1, 999999990, 'sc1006', 'ky7666321');
INSERT INTO tf (id, sid, tp, fn) VALUES(1007, 302, '12754', 'fn7');
INSERT IGNORE INTO tm (id, fid, ts, te, sc, ky) VALUES
   (7666322, 1007, 1, 999999990, 'sc1007', 'ky7666322'),
	-- shortened
   (7668321, 1007, 1, 999999990, 'sc1007', 'ky7668321');
INSERT INTO tf (id, sid, tp, fn) VALUES(1008, 302, '19908', 'fn8');
INSERT IGNORE INTO tm (id, fid, ts, te, sc, ky) VALUES
   (7668322, 1008, 1, 999999990, 'sc1008', 'ky7668322'),
	-- shortened	
	(7670321, 1008, 1, 999999990, 'sc1008', 'ky7670321');
INSERT INTO tf (id, sid, tp, fn) VALUES(1009, 302, '23796', 'fn9');
INSERT IGNORE INTO tm (id, fid, ts, te, sc, ky) VALUES
   (7670322, 1009, 1, 999999990, 'sc1009', 'ky7670322'),
	-- shortened	   
   (7672321, 1009, 1, 999999990, 'sc1009', 'ky7672321'); 

*** end of shortened step1.sql ***
   
step2a.sql adds 2000 lines per line of table "tf" to table "tm" again.
Here, however, "tm.ts" and "tm.te" are set to 999999997 so that step3ff.sql can expect the same result at any time after execution of step1.sql.

*** begin of shortened step2a.sql ***

INSERT IGNORE INTO tm (id, fid, ts, te, sc, ky) VALUES   (7672322, 1001, 999999997, 999999997, 'sc1001', 'ky7672322'),
   (7672323, 1001, 999999997, 999999997, 'sc1001', 'ky7672323'),
    -- shortened
   (7674321, 1001, 999999997, 999999997, 'sc1001', 'ky7674321');
INSERT IGNORE INTO tm (id, fid, ts, te, sc, ky) VALUES   (7674322, 1002, 999999997, 999999997, 'sc1002', 'ky7674322'),
   (7674323, 1002, 999999997, 999999997, 'sc1002', 'ky7674323'),   
    -- shortened
   (7676321, 1002, 999999997, 999999997, 'sc1002', 'ky7676321');
INSERT IGNORE INTO tm (id, fid, ts, te, sc, ky) VALUES   (7676322, 1003, 999999997, 999999997, 'sc1003', 'ky7676322'),
   (7676323, 1003, 999999997, 999999997, 'sc1003', 'ky7676323'),
    -- shortened
   (7678321, 1003, 999999997, 999999997, 'sc1003', 'ky7678321');
INSERT IGNORE INTO tm (id, fid, ts, te, sc, ky) VALUES   (7678322, 1004, 999999997, 999999997, 'sc1004', 'ky7678322'),
   (7678323, 1004, 999999997, 999999997, 'sc1004', 'ky7678323'),
    -- shortened
   (7680321, 1004, 999999997, 999999997, 'sc1004', 'ky7680321');
INSERT IGNORE INTO tm (id, fid, ts, te, sc, ky) VALUES   (7680322, 1005, 999999997, 999999997, 'sc1005', 'ky7680322'),
   (7680323, 1005, 999999997, 999999997, 'sc1005', 'ky7680323'),
    -- shortened
   (7682321, 1005, 999999997, 999999997, 'sc1005', 'ky7682321');
INSERT IGNORE INTO tm (id, fid, ts, te, sc, ky) VALUES   (7682322, 1006, 999999997, 999999997, 'sc1006', 'ky7682322'),
   (7682323, 1006, 999999997, 999999997, 'sc1006', 'ky7682323'),
    -- shortened
   (7684321, 1006, 999999997, 999999997, 'sc1006', 'ky7684321');
INSERT IGNORE INTO tm (id, fid, ts, te, sc, ky) VALUES   (7684322, 1007, 999999997, 999999997, 'sc1007', 'ky7684322'),
   (7684323, 1007, 999999997, 999999997, 'sc1007', 'ky7684323'),
    -- shortened
   (7686321, 1007, 999999997, 999999997, 'sc1007', 'ky7686321');
INSERT IGNORE INTO tm (id, fid, ts, te, sc, ky) VALUES   (7686322, 1008, 999999997, 999999997, 'sc1008', 'ky7686322'),
   (7686323, 1008, 999999997, 999999997, 'sc1008', 'ky7686323'),
    -- shortened
   (7688321, 1008, 999999997, 999999997, 'sc1008', 'ky7688321');
INSERT IGNORE INTO tm (id, fid, ts, te, sc, ky) VALUES   (7688322, 1009, 999999997, 999999997, 'sc1009', 'ky7688322'),
   (7688323, 1009, 999999997, 999999997, 'sc1009', 'ky7688323'),
    -- shortened
   (7690321, 1009, 999999997, 999999997, 'sc1009', 'ky7690321');   

*** end of shortened step2a.sql ***

step2b.sql exactly deletes the data sets inserted in step2a.sql. This should return the database to the same state as after step1.sql.

*** begin of shortened step2b.sql ***
   
DELETE FROM tm WHERE id IN (
'7672322',
'7672323',
'7672324',
'7672325',
-- shortened
'7690319',
'7690320',
'7690321');   

*** end of shortened step2b.sql ***

step3ff.sql fetches the data sets inserted in step1.sql in the following way. 

*** begin of step3ff.sql ***

SELECT count(*) FROM tf INNER JOIN tm ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn1' AND tm.ts <= 999999990 AND tm.te >= 999999990;
SELECT count(*) FROM tm INNER JOIN tf ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn1' AND tm.ts <= 999999990 AND tm.te >= 999999990;
SELECT count(*) FROM tm INNER JOIN tf ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn1' AND tm.ts <= 999999990 AND tm.te >= 999999990;
SELECT count(*) FROM tf INNER JOIN tm ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn1' AND tm.ts <= 999999990 AND tm.te >= 999999990;
                
SELECT count(*) FROM tm INNER JOIN tf ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn2' AND tm.ts <= 999999990 AND tm.te >= 999999990;
SELECT count(*) FROM tf INNER JOIN tm ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn2' AND tm.ts <= 999999990 AND tm.te >= 999999990;
SELECT count(*) FROM tf INNER JOIN tm ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn2' AND tm.ts <= 999999990 AND tm.te >= 999999990;
SELECT count(*) FROM tm INNER JOIN tf ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn2' AND tm.ts <= 999999990 AND tm.te >= 999999990;
                
SELECT count(*) FROM tf INNER JOIN tm ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn3' AND tm.ts <= 999999990 AND tm.te >= 999999990;
SELECT count(*) FROM tm INNER JOIN tf ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn3' AND tm.ts <= 999999990 AND tm.te >= 999999990;
SELECT count(*) FROM tf INNER JOIN tm ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn3' AND tm.ts <= 999999990 AND tm.te >= 999999990;
SELECT count(*) FROM tm INNER JOIN tf ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn3' AND tm.ts <= 999999990 AND tm.te >= 999999990;
                
SELECT count(*) FROM tf INNER JOIN tm ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn4' AND tm.ts <= 999999990 AND tm.te >= 999999990;
SELECT count(*) FROM tm INNER JOIN tf ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn4' AND tm.ts <= 999999990 AND tm.te >= 999999990;
SELECT count(*) FROM tf INNER JOIN tm ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn4' AND tm.ts <= 999999990 AND tm.te >= 999999990;
SELECT count(*) FROM tm INNER JOIN tf ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn4' AND tm.ts <= 999999990 AND tm.te >= 999999990;
                
SELECT count(*) FROM tf INNER JOIN tm ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn6' AND tm.ts <= 999999990 AND tm.te >= 999999990;
SELECT count(*) FROM tm INNER JOIN tf ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn6' AND tm.ts <= 999999990 AND tm.te >= 999999990;
SELECT count(*) FROM tf INNER JOIN tm ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn6' AND tm.ts <= 999999990 AND tm.te >= 999999990;
SELECT count(*) FROM tm INNER JOIN tf ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn6' AND tm.ts <= 999999990 AND tm.te >= 999999990;
                
SELECT count(*) FROM tf INNER JOIN tm ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn5' AND tm.ts <= 999999990 AND tm.te >= 999999990;
SELECT count(*) FROM tm INNER JOIN tf ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn5' AND tm.ts <= 999999990 AND tm.te >= 999999990;
SELECT count(*) FROM tf INNER JOIN tm ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn5' AND tm.ts <= 999999990 AND tm.te >= 999999990;
SELECT count(*) FROM tm INNER JOIN tf ON tf.id = tm.fid WHERE tf.sid = 302 AND tf.fn = 'fn5' AND tm.ts <= 999999990 AND tm.te >= 999999990; 

*** end of step3ff.sql ***

In this simple example, only the number is determined.
All queries contained here should normally return 2000 as 2000 lines per line in "tf" are contained in table "tm".
So that the necessary conditions are fulfilled, attention was already paid to this in step1.sql.

Especially impressive is that even identical queries can lead to different results and that if the result is wrong it is always "1".
It is also noticeable that an odd-numbered query always returns the correct result and that even-numbered queries can produce wrong results.  

How do I know which versions are affected?
Docker is your friend, you can quickly test any version with it. Here is the result:
[21.06.2018 13:44:17] [TOTAL] [INF] Total result:
Version, sec, Result
 5.5.50,  28,     OK
 5.5.51,  26,     OK
 5.5.52,  24,     OK
 5.5.53,  25,     OK
 5.5.54,  28,     OK
 5.5.55,  26,     OK
 5.5.56,  26,     OK
 5.5.57,  26,     OK
 5.5.58,  27,     OK
 5.5.59,  23,     OK
 5.5.60,  24,     OK
 5.6.30,  26,     OK
 5.6.31,  26,     OK
 5.6.32,  25,     OK
 5.6.33,  26,     OK
 5.6.34,  26,     OK
 5.6.35,  26,     OK
 5.6.36,  28, FAILED 350 times
 5.6.37,  26, FAILED 338 times
 5.6.38,  27, FAILED 332 times
 5.6.39,  25, FAILED 324 times
 5.6.40,  26, FAILED 330 times
 5.7.10,  30,     OK
 5.7.11,  28,     OK
 5.7.12,  25,     OK
 5.7.13,  23,     OK
 5.7.14,  30,     OK
 5.7.15,  31,     OK
 5.7.16,  30,     OK
 5.7.17,  31,     OK
 5.7.18,  30, FAILED 300 times
 5.7.19,  27, FAILED 296 times
 5.7.20,  34, FAILED 302 times
 5.7.21,  24, FAILED 310 times
 5.7.22,  30, FAILED 300 times

For each version 30 attempts were made to provoke the error.
Here is the output for version 5.7.22. The results from step3ff.sql are arranged horizontally here.
[21.06.2018 13:43:25] [5.7.22] [INF] Start Test
[21.06.2018 13:43:25] [5.7.22] [INF] Start DB
[21.06.2018 13:43:36] [5.7.22] [INF] Waiting for database connection
........+-------------------------+------------------------------+
| Variable_name           | Value                        |
+-------------------------+------------------------------+
| innodb_version          | 5.7.22                       |
| protocol_version        | 10                           |
| slave_type_conversions  |                              |
| tls_version             | TLSv1,TLSv1.1                |
| version                 | 5.7.22                       |
| version_comment         | MySQL Community Server (GPL) |
| version_compile_machine | x86_64                       |
| version_compile_os      | Linux                        |
+-------------------------+------------------------------+

[21.06.2018 13:43:45] [5.7.22] [INF] Preparing DB (Step 1)
[21.06.2018 13:43:46] [5.7.22] [INF]  state before:  2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000
[21.06.2018 13:43:46] [5.7.22] [ERR] run  0 result:  2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(12)
[21.06.2018 13:43:47] [5.7.22] [ERR] run  1 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:43:48] [5.7.22] [ERR] run  2 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:43:49] [5.7.22] [ERR] run  3 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:43:50] [5.7.22] [ERR] run  4 result:  2000    1 2000    1 2000 2000 2000 2000 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(8)
[21.06.2018 13:43:51] [5.7.22] [ERR] run  5 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:43:52] [5.7.22] [ERR] run  6 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:43:54] [5.7.22] [ERR] run  7 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:43:55] [5.7.22] [ERR] run  8 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:43:56] [5.7.22] [ERR] run  9 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:43:56] [5.7.22] [ERR] run 10 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:43:57] [5.7.22] [ERR] run 11 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:43:58] [5.7.22] [ERR] run 12 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:43:59] [5.7.22] [ERR] run 13 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:44:00] [5.7.22] [ERR] run 14 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:44:01] [5.7.22] [ERR] run 15 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:44:02] [5.7.22] [ERR] run 16 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:44:03] [5.7.22] [ERR] run 17 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:44:04] [5.7.22] [ERR] run 18 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:44:05] [5.7.22] [ERR] run 19 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:44:06] [5.7.22] [ERR] run 20 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:44:07] [5.7.22] [ERR] run 21 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:44:07] [5.7.22] [ERR] run 22 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:44:08] [5.7.22] [ERR] run 23 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:44:09] [5.7.22] [ERR] run 24 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:44:10] [5.7.22] [ERR] run 25 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:44:11] [5.7.22] [ERR] run 26 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:44:13] [5.7.22] [ERR] run 27 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:44:14] [5.7.22] [ERR] run 28 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:44:15] [5.7.22] [ERR] run 29 result:  2000    1 2000    1 2000 2000 2000 2000 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 2000    1 FAILED(10)
[21.06.2018 13:44:15] [5.7.22] [INF] stop DB
[21.06.2018 13:44:17] [5.7.22] [INF] remove docker
[21.06.2018 13:44:17] [5.7.22] [INF] ***********************
[21 Jun 2018 15:27] Mark Schuart
All files mentioned in description.

Attachment: mysql-bug-data-91362.zip (application/x-zip-compressed, text), 231.36 KiB.

[22 Jun 2018 4:45] Umesh Shastry
Hello Mark,

Thank you for the report and test case.
Observed that 5.6.40 and 5.7.22 are affected.

Thanks,
Umesh
[22 Jun 2018 4:54] Umesh Shastry
## 8.0.11  - not affected

./runSimple.sh
+-------------------------+------------------------------+
| Variable_name           | Value                        |
+-------------------------+------------------------------+
| innodb_version          | 8.0.11                       |
| protocol_version        | 10                           |
| slave_type_conversions  |                              |
| tls_version             | TLSv1,TLSv1.1,TLSv1.2        |
| version                 | 8.0.11                       |
| version_comment         | MySQL Community Server - GPL |
| version_compile_machine | x86_64                       |
| version_compile_os      | linux-glibc2.12              |
| version_compile_zlib    | 1.2.11                       |
+-------------------------+------------------------------+
Expected: 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000
  run 0 : 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000
  run 1 : 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000
  run 2 : 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000
  run 3 : 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000
  run 4 : 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000
  run 5 : 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000
  run 6 : 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000
  run 7 : 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000
  run 8 : 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000
  run 9 : 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000
after sleep: 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 2000
[22 Jun 2018 4:56] Umesh Shastry
Bug #87911 marked as duplicate of this one
[12 Feb 11:08] Sveta Smirnova
The bug is not repeatable after version 5.7.23
[13 Feb 14:05] Sveta Smirnova
Duplicate of bug #91032