Bug #21123 Test "func_misc" is not sutable for "embedded" runs
Submitted: 18 Jul 2006 18:20 Modified: 13 Aug 2007 15:05
Reporter: Joerg Bruehe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Tests Severity:S3 (Non-critical)
Version:4.1.21 OS:Any (all Unix)
Assigned to: Magnus Blåudd CPU Architecture:Any

[18 Jul 2006 18:20] Joerg Bruehe
Description:
Release build of 4.1.21

Test "func_misc" attempts to set locks which fails in "embedded" runs:

-------------------------------------------------------
*** r/func_misc.result
--- r/func_misc.reject
***************
*** 75,95
  1
  SELECT RELEASE_LOCK('bug16501');
  RELEASE_LOCK('bug16501')
! 1
  GET_LOCK('bug16501',600)
! 1
  SELECT IS_USED_LOCK('bug16501') = connection_id
 ...
  SELECT IS_USED_LOCK('bug16501');
  IS_USED_LOCK('bug16501')
! NULL
  DROP TABLE t1;
--- 75,95
  1
  SELECT RELEASE_LOCK('bug16501');
  RELEASE_LOCK('bug16501')
! 0
  GET_LOCK('bug16501',600)
! 0
  SELECT IS_USED_LOCK('bug16501') = connection_id
 ...
  SELECT IS_USED_LOCK('bug16501');
  IS_USED_LOCK('bug16501')
! 1
  DROP TABLE t1;
-------------------------------------------------------

How to repeat:
Build "embedded" and run the test suite.
[29 Jul 2006 5:07] Ian Greenhoe
The problem is that when we are running embedded inside the mysqltest_embedded application, we are not multithreading.  This causes us to deadlock with ourselves, since this part of the test assumes that we are multithreaded.

My recommended solution:  Split the func_misc tests into two sets of tests, with one embedded safe, the other not.  (The not safe for embedded test would only contain the regression for bug #16501.)

The other (impractical?) solution is to extend mysqltest to be multithreaded.
[4 Aug 2006 11:57] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/10047

ChangeSet@1.2518, 2006-08-04 04:57:30-07:00, igreenhoe@anubis.greendragongames.com +3 -0
  Fix for bug #21123 (Test "func_misc" is not sutable for "embedded"
  runs)
  
  Problem:  Test caused a deadlock in the embedded server.  Deadlock
  cannot be practically resolved (it would require true multithreading
  in mysqltest_embedded).
  
  Solution:  Split the test into two tests.  One test is appropriate
  for running with embedded, the other is not.
[4 Aug 2006 12:29] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/10048

ChangeSet@1.2537, 2006-08-04 05:29:12-07:00, igreenhoe@anubis.greendragongames.com +4 -0
  Fix for bug #21123 (Test "func_misc" is not sutable for "embedded"
  runs)
  
  Problem:  Test caused a deadlock in the embedded server.  Deadlock
  cannot be practically resolved (it would require true multithreading
  in mysqltest_embedded).
  
  Solution:  Split the test into two tests.  One test is appropriate
  for running with embedded, the other is not.
[24 Aug 2006 23:25] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/10861

ChangeSet@1.2537, 2006-08-24 16:25:23-07:00, igreenhoe@anubis.greendragongames.com +4 -0
  Fix for bug #21123 (Test "func_misc" is not sutable for "embedded"
  runs)
  
  Problem:  Test caused a deadlock in the embedded server.  Deadlock
  cannot be practically resolved (it would require true multithreading
  in mysqltest_embedded).
  
  Solution:  Split the test into two tests.  One test is appropriate
  for running with embedded, the other is not.  Added line to test not
  appropriate for embedded to cause it to skip while running in
  embedded mode.
[8 Feb 2007 9:42] Magnus Blåudd
Everything reported by this bug report are working now. No need to keep it open anymore.
[21 Jun 2007 20:15] Bugs System
Pushed into 5.1.20-beta
[8 Aug 2007 17:15] Joerg Bruehe
I cannot say which bug the above push fixed,
but definitely not this one - just look at the changeset contents.

The problem of this bug still occurs.
Can't we have the approved patch re-tested (in 4.1 !) and then pushed ?

Here is an extract of the 5.1.21-beta build:

-------------------------------------------------------
*** /PATH/mysql-test/r/func_misc.result
--- /PATH/mysql-test/r/func_misc.reject
***************
*** 67,77
  FROM t1
  WHERE conn = 'default';
  IS_USED_LOCK('bug16501') = connection_id
! 1
  SELECT GET_LOCK('bug16501',600);
  SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID();
  IS_USED_LOCK('bug16501') = CONNECTION_ID()
! 1
  SELECT RELEASE_LOCK('bug16501');
  RELEASE_LOCK('bug16501')
  1
--- 67,77
  FROM t1
  WHERE conn = 'default';
  IS_USED_LOCK('bug16501') = connection_id
! 0
  SELECT GET_LOCK('bug16501',600);
  SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID();
  IS_USED_LOCK('bug16501') = CONNECTION_ID()
! 0
  SELECT RELEASE_LOCK('bug16501');
  RELEASE_LOCK('bug16501')
  1
***************
*** 81,90
  FROM t1
  WHERE conn = 'con1';
  IS_USED_LOCK('bug16501') = connection_id
! 1
  SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID();
  IS_USED_LOCK('bug16501') = CONNECTION_ID()
! 1
  SELECT RELEASE_LOCK('bug16501');
  RELEASE_LOCK('bug16501')
  1
--- 81,90
  FROM t1
  WHERE conn = 'con1';
  IS_USED_LOCK('bug16501') = connection_id
! 0
  SELECT IS_USED_LOCK('bug16501') = CONNECTION_ID();
  IS_USED_LOCK('bug16501') = CONNECTION_ID()
! 0
  SELECT RELEASE_LOCK('bug16501');
  RELEASE_LOCK('bug16501')
  1
-------------------------------------------------------

Priority set appropriate to test suite failure.
[13 Aug 2007 14:43] Magnus Blåudd
Problem occurs because connection_id() always returns 0 when running with --embedded in 5.1
[13 Aug 2007 15:05] Magnus Blåudd
Filed "Bug#30389 connection_id() always return 0 in embedded server" that outlines the real problem of this failure and also correct version. The problem is only in 5.1.22 although it looks exactly the same as this bug.