Bug #68876 Disabling innodb_thread_concurrency might cause queries to hang
Submitted: 5 Apr 2013 21:53 Modified: 9 Apr 2013 5:32
Reporter: Davi Arnaut (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:5.5.30 OS:Any
Assigned to: CPU Architecture:Any
Tags: concurrency tickets, innodb, thread concurrency

[5 Apr 2013 21:53] Davi Arnaut
Description:
Disabling InnoDB's thread concurrency at runtime causes threads waiting in the concurrency queue to hang. The problem is that once innodb_thread_concurrency is set to 0, threads waiting in the queue are do not waked up, neither when the variable is set to zero, nor when threads that were inside InnoDB exit.

How to repeat:
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,1),(2,2),(3,3);

SET GLOBAL innodb_thread_concurrency = 1;

connect(con1,localhost,root,,);
BEGIN;
SELECT * FROM t1 WHERE a = 1;

connect(con2,localhost,root,,);
BEGIN;
SELECT * FROM t1 WHERE a = 1;

connection con1;
SET DEBUG_SYNC='innodb_row_update_for_mysql_begin SIGNAL inside_innodb WAIT_FOR go';
send UPDATE t1 SET b = b + 1 WHERE a = 2;

connection default;
SET DEBUG_SYNC='now WAIT_FOR inside_innodb';

connection con2;
send SELECT * FROM t1 WHERE a = 3;

connection default;
let $wait_condition=
  SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_TRX
  WHERE trx_query = 'SELECT * FROM t1 WHERE a = 3' AND
        trx_operation_state = 'waiting in InnoDB queue';
--source include/wait_condition.inc

SET GLOBAL innodb_thread_concurrency = 0;

SET DEBUG_SYNC='now SIGNAL go';

--echo # reap con1
connection con1;
reap;

--echo # reap con2
connection con2;
reap;
[5 Apr 2013 22:23] Mark Callaghan
I thought Domas reported this long ago?
[5 Apr 2013 23:32] Davi Arnaut
There is Bug#40760, but that is supposedly fixed in 5.5.
[24 Jul 2013 12:31] MySQL Verification Team
Bug #69810 Marked as duplicate of this