Bug #44042 mysqltest must ensure that there is 'reap' after 'send' in embedded server
Submitted: 2 Apr 2009 10:05 Modified: 15 Jan 2010 11:23
Reporter: Alexander Nozdrin Email Updates:
Status: Duplicate Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S7 (Test Cases)
Version: OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[2 Apr 2009 10:05] Alexander Nozdrin
Description:
mysqltest does not ensure that there is 'reap' after 'send'.
In the standalone server that is Ok, since the server handles
multiple connections by itself. In the embedded server that
produces a race condition and may lead to a crash.

The problem is that the embedded server does not handle
connections, so the mysqltest creates a new thread for each
processing of the 'send' directive. If mysqltest does not
guarantee that there is 'reap' for 'send', it is possible to
start executing a new query while the server is busy with
the previous query.

How to repeat:
Run the following test case in the embedded server mode:
--------------------------------------------------------
create procedure p1() select sleep(180);

--connect (con1, localhost, root,,test,,)
--send call p1;

--connection default
select 1;

--connection con1
select 2; # <-- Here must be 'reap', otherwise it crashes
--------------------------------------------------------

It creates a long running procedure, which is asynchronously
called in a separate connection (mysqltest thread). So, a long
running procedure is being run in 'thd#2'. Then, we switch
connections back and forth, and execute 'select 2' again
in 'thd#2' while the procedure is still running there. 

Suggested fix:
Die with an error if a new query comes when there is a pending query.
[2 Apr 2009 10:47] Alexander Nozdrin
Minimal test case:
----------------------------------------------------
create procedure p1() select sleep(180);

--send call p1;

select 1;
----------------------------------------------------
[15 Jan 2010 11:23] Bjørn Munch
Same issue as Bug #49269.