Bug #20225 mysqltest runs in an endless loop when trying to start rpl_sys test suite
Submitted: 2 Jun 2006 13:48 Modified: 16 Jan 2007 12:57
Reporter: Carsten Segieth Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Tests Severity:S7 (Test Cases)
Version:5.0.19 - 5.0.28 OS:Windows (Windows)
Assigned to: Magnus Blåudd CPU Architecture:Any
Tags: mysqltest

[2 Jun 2006 13:48] Carsten Segieth
Description:
mysqltest.exe seems to run in an endless loop. on my laptop the CPU goes to 100% and makes it difficult to do anything other, on a 4 CPU machine it shows 'heavy' CPU usage.

The command that loops is: 

echo "stop slave; " | D:/MySQL/mysql-5.0.19-win32/bin/mysqltest  -h127.0.0.1 -P9308  -uroot

and the output of the test 'run_rplsys' around this should look like this

[...snip...]
TEST                           RESULT
-------------------------------------------------------

rpl_alter
Servers started, exiting
===========================  Restarting replication ===========================
stop slave;
Warnings:
Note    1255    Slave already has been stopped
ok
reset master;
ok
[...snip...]

but after the line '=== Restarting replication ===' nothing more is shown and the CPU goes 'up'.

The last tested 'mysqltest.exe' where no loop occurs was 5.0.17a-cert. Using a 5.0.19 binary the loop can be seen.

How to repeat:
(having cloned the mysql-test-extra-5.0 tree):
cd /cygdrive/c/MySQL/mysql-test-extra-5.0-bk/mysql-test/suite/rpl_sys
./run_rplsys_WIN --config=<a_config_file> --start-server-only --client-hostname=qa-srv-c.mysql.com

Suggested fix:
remove endless loop
[29 Jun 2006 21:16] Carsten Segieth
- changed prio to P1 as the problem occured when running an existing test (suite rpl_sys from mysql-test-extra-5.0)
- the correct command is "./run_rplsys ...", please disregard the ..._WIN mentioned in the original description.
[26 Sep 2006 11:33] Carsten Segieth
with 5.0.24a the problem still exists.
[11 Dec 2006 10:10] Carsten Segieth
I just got an endless loop when running a very simple "test" with 5.0.28 in a DOS window. This small "test" does nothing other than looking for the version of the server it runs against. So the problem seems to be related not only to the rpl_test which are mentioned when submitting this bug.

This makes it impossible to use mysqltest.exe from a DOS box at the moment. Here the commandline I used:

d:/MySQL/Server-5.0/bin/mysqltest.exe --no-defaults --silent -v --skip-safemalloc --tmpdir=d:/MySQL/Server-5.0/mysql-test/var/tmp --socket=d:/MySQL/Server-5.0/mysql-test/var/tmp/master.sock --port=3307 --database=test --user=root --password= --test-file d:/MySQL/Server-5.0/mysql-test/suite/funcs_1/t/a_version_check.test --result-file d:/MySQL/Server-5.0/mysql-test/suite/funcs_1/r/a_version_check.result
[11 Dec 2006 14:28] Magnus Blåudd
Started a mysqld with ./mysql-test-run.pl --start-and-exit

Tested from a DOS command prompt.
C:\mysql\mysql-5.0.32-pb285\mysql-test>..\client\debug\mysqltest.exe --verbose -
-port=9306
It will in this way read from stdin, so I did "use test", "create table ta (a int)" and "select * from t1" without problem.
[11 Dec 2006 14:31] Magnus Blåudd
The --socket  argument is ignored
[11 Dec 2006 14:35] Magnus Blåudd
I can't fine anyplace where it hangs except for the loop in safe_connect. Will add a small printout there which will be printed when running with --verbose.

Please try to add the option --debug to the argument list when starting mysqltest, that will print the tracelog directly to the screen and might give an indication of where it's looping.
[11 Dec 2006 14:39] 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/16775

ChangeSet@1.2589, 2006-12-11 15:39:15+01:00, msvensson@neptunus.(none) +1 -0
  Bug#20225 mysqltest runs in an endless loop when trying to start rpl_sys test suite
   - Add printout in safe_connect indicating that mysqltest is in a loop waiting for
  connection to mysqld. Will be printed when --verbose is passed as argument to
    mysqltest
[12 Jan 2007 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[15 Jan 2007 16:09] Carsten Segieth
The code change seems to help - it no longer hangs, but without seeing something printed out. I used mysqltest.exe from pushbuild (5.0.34.pb316) and with this the problem cannot be reproduced, with and without the option "--verbose".
Using an older binary, e.g. 5.0.28, the problem occurs.

pino@IBM /cygdrive/d/MySQL/mysql-test-extra-5.0/mysql-test/suite/rpl_sys
$ ll D:/MySQL/mysql-enterprise-5.0.28-win32/bin/mysqltest*
-rwxrwxrwx+ 1 pino Kein 1.4M Jun 20  2006 D:/MySQL/mysql-enterprise-5.0.28-win32/bin/mysqltest.5.0.17c.exe*
-rwxrwxrwx+ 1 pino Kein 1.6M Oct 25 13:24 D:/MySQL/mysql-enterprise-5.0.28-win32/bin/mysqltest.5.0.28.exe*
-rwxrwxrwx+ 1 pino Kein 1.6M Jan 12 06:31 D:/MySQL/mysql-enterprise-5.0.28-win32/bin/mysqltest.5.0.34.pb316.exe*

pino@IBM /cygdrive/d/MySQL/mysql-test-extra-5.0/mysql-test/suite/rpl_sys
$ echo "stop slave; " | D:/MySQL/mysql-enterprise-5.0.28-win32/bin/mysqltest*17*  -h127.0.0.1 -P9308  -uroot
stop slave;
ok

pino@IBM /cygdrive/d/MySQL/mysql-test-extra-5.0/mysql-test/suite/rpl_sys
$ echo "stop slave; " | D:/MySQL/mysql-enterprise-5.0.28-win32/bin/mysqltest*28*  -h127.0.0.1 -P9308  -uroot
  < I needed to kill it with CTRL_C >

pino@IBM /cygdrive/d/MySQL/mysql-test-extra-5.0/mysql-test/suite/rpl_sys
$ echo "stop slave; " | D:/MySQL/mysql-enterprise-5.0.28-win32/bin/mysqltest*34*  --verbose -h127.0.0.1 -P9308  -uroot
stop slave;
ok
[16 Jan 2007 10:32] Carsten Segieth
The problem does not depend on using "stop slave;" command, it also hangs with other commands when using mysqltest.exe 5.0.24 .. 5.0.28. Using version 5.0.22 (and older) or 5.0.30 (or newer) it works.

$ VERS=30; ll D:/MySQL/mysql-enterprise-5.0.28-win32/bin/mysqltest*${VERS}*; echo "SELECT version(); " | D:/MySQL/mysql-enterprise-5.0.28-win32/bin/mysqltest*$
{VERS}* -h127.0.0.1 -P9308 -uroot
-rwxrwxrwx+ 1 pino Kein 1.6M Dec 20 13:45 D:/MySQL/mysql-enterprise-5.0.28-win32/bin/mysqltest.5.0.30.exe*
SELECT version();
version()
5.0.28-enterprise-nt-log
ok

pino@IBM /cygdrive/d/MySQL/mysql-test-extra-5.0/mysql-test/suite/rpl_sys
$ VERS=28; ll D:/MySQL/mysql-enterprise-5.0.28-win32/bin/mysqltest*${VERS}*; echo "SELECT version(); " | D:/MySQL/mysql-enterprise-5.0.28-win32/bin/mysqltest*$
{VERS}* -h127.0.0.1 -P9308 -uroot
-rwxrwxrwx+ 1 pino Kein 1.6M Oct 25 13:24 D:/MySQL/mysql-enterprise-5.0.28-win32/bin/mysqltest.5.0.28.exe*
<I need to use *CTRL_C to stop it ...>
[16 Jan 2007 12:56] Magnus Blåudd
Problem was caused by zero length strings inserted in the "patterns" array used to find paths that should be converted from windows format to unix format that we use in our result files.

The patch for this is in 'init_win_path_patterns' function.

mysqltest.c>>
void init_win_path_patterns()
{
  /* List of string patterns to match in order to find paths */
  const char* paths[] = { "$MYSQL_TEST_DIR",
                          "$MYSQL_TMP_DIR",
                          "$MYSQLTEST_VARDIR",
                          "./test/" };
<snip>

  /* Loop through all paths in the array */
  for (i= 0; i < num_paths; i++)
  {

<snip>

    /* Don't insert zero length strings in patterns array */
    if (strlen(p) == 0) 
    { 
      my_free(p, MYF(0));
      continue;
    }
<snip>
[16 Jan 2007 12:57] Magnus Blåudd
The part after "Don't insert zero lenght strings" was the fix.