Bug #35132 MySQLadmin --wait ping always crashes on Windows systems
Submitted: 7 Mar 2008 2:21 Modified: 14 Sep 2009 19:36
Reporter: Richard Otter Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Command-line Clients Severity:S2 (Serious)
Version:5.0.51/5.1/6.0 OS:Microsoft Windows (WinXP SP2 current patchlevel)
Assigned to: Tatiana Azundris Nuernberg CPU Architecture:Any
Triage: Triaged: D2 (Serious)

[7 Mar 2008 2:21] Richard Otter
mysqladmin -u root -ppasswd --wait  ping
always crashes soon after the message-"Waiting for MySQL server to answer" appears

I want to have a way of waiting for a mysql instance to start up and accept connections in my application installer so that I can log in and create the database and schema.

How to repeat:
To reproduce, place the following lines in a .cmd file and run in it in a command shell.

net stop mysql
net start mysql
mysqladmin -u root  -ppasswd --wait  ping
[7 Mar 2008 4:43] Valeriy Kravchuk
Thank you for a bug report. Sorry, but I can not repeat the behaviour described:

C:\Program Files\MySQL\MySQL Server 5.0\bin>mysqladmin -uroot -proot -P3308 --wa
it ping
mysqld is alive

C:\Program Files\MySQL\MySQL Server 5.0\bin>restart.cmd

C:\Program Files\MySQL\MySQL Server 5.0\bin>net stop MySQL5
The MySQL5 service is stopping..
The MySQL5 service was stopped successfully.

C:\Program Files\MySQL\MySQL Server 5.0\bin>net start MySQL5
The MySQL5 service is starting.
The MySQL5 service was started successfully.

C:\Program Files\MySQL\MySQL Server 5.0\bin>mysqladmin -uroot -proot --wait ping

mysqld is alive

So, please, provide mor details like MySQL's error log, for example. Are you sure service started successfully?
[7 Apr 2008 23: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".
[14 Apr 2008 17:19] Susanne Ebrecht

we still need more informations like and error log.
[14 May 2008 23: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".
[21 Aug 2008 12:38] Kim Starks
Steps to reproduce

1) Ensure that the MySQL server is down, this is critical to reproducing the bug.
2) mysqladmin.exe --wait version
3) see "Waiting for MySQL server to answer" and a moment later it will crash.  I additionally get a message asking me if I wish to debug the problem.

I'm able to reproduce this with 5.0.46, 5.0.62 (professional versions).  5.0.27 community version works.
[21 Aug 2008 12:43] Kim Starks
uploaded a windows dump file (zipped) called bug-data-35132.zip for v5.0.46
[21 Aug 2008 12:48] Miguel Solorzano
Verified on bzr 5.0. I will test other version:

>	mysqladmin.exe!strlen()  Line 78	Asm
 	mysqladmin.exe!create_shared_memory(st_mysql * mysql=0x0012fb14, st_net * net=0x0012fb14, unsigned int connect_timeout=0)  Line 419 + 0x15	C
 	mysqladmin.exe!mysql_real_connect(st_mysql * mysql=0x0012fb14, const char * host=0x00000000, const char * user=0x0068c637, const char * passwd=0x0068c638, const char * db=0x00000000, unsigned int port=0, const char * unix_socket=0x00000000, unsigned long client_flag=0)  Line 1897 + 0x1a	C
 	mysqladmin.exe!sql_connect(st_mysql * mysql=0x0012fb14, unsigned int wait=4294967295)  Line 439 + 0x2e	C++
 	mysqladmin.exe!main(int argc=1, char * * argv=0x003729c4)  Line 359 + 0x12	C++
 	mysqladmin.exe!mainCRTStartup()  Line 259 + 0x19	C
[21 Aug 2008 12:55] Miguel Solorzano
Thank you for the feedback, verified with last comment how to repeat.
[21 Jul 2009 0:41] Tatiana Azundris Nuernberg
mysqladmin.cc calls mysql_real_connect() in a loop, but m/r/c frees parts of the MYSQL struct on failure (unless CLIENT_REMEMBER_OPTIONS is passed, which indeed heels the bug described above).
[31 Aug 2009 17:01] 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:


2799 Tatiana A. Nurnberg	2009-08-31
      Bug#35132: MySQLadmin --wait ping always crashes on Windows systems
      Failing to connect would release parts of the MYSQL struct.
      We would then proceed to try again to connect without re-
      initializing the struct.
      We prevent the unwanted freeing of data we'll still need now.
     @ client/mysqladmin.cc
        Losing a connection (or not even getting on in the first place) should
        not trash the MYSQL-struct.
        Add a lot of comments.
        Rewrite re-connection fu.
     @ sql-common/client.c
        Assert against bad parameters usually caused by de-initing a
        MYSQL-struct without re-initing it again before re-use.
[2 Sep 2009 10:25] Bugs System
Pushed into 5.0.86 (revid:joro@sun.com-20090902102337-n5rw8227wwp5cpx8) (version source revid:azundris@mysql.com-20090831170113-my01udoz6vdl9831) (merge vers: 5.0.86) (pib:11)
[2 Sep 2009 16:42] Bugs System
Pushed into 5.1.39 (revid:joro@sun.com-20090902154533-8actmfcsjfqovgsb) (version source revid:azundris@mysql.com-20090831194033-tposywbxufet4q5y) (merge vers: 5.1.39) (pib:11)
[4 Sep 2009 1:07] Paul Dubois
Noted in 5.0.86, 5.1.39 changelogs.

mysqladmin --wait ping crashed on Windows systems.

Setting report to NDI pending push into 5.4.x.
[14 Sep 2009 16:03] Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090914155317-m1g9wodmndzdj4l1) (version source revid:alik@sun.com-20090914155317-m1g9wodmndzdj4l1) (merge vers: 5.4.4-alpha) (pib:11)
[14 Sep 2009 19:36] Paul Dubois
Noted in 5.4.4 changelog.
[1 Oct 2009 5:59] Bugs System
Pushed into 5.1.39-ndb-6.3.28 (revid:jonas@mysql.com-20091001055605-ap2kiaarr7p40mmv) (version source revid:jonas@mysql.com-20091001055605-ap2kiaarr7p40mmv) (merge vers: 5.1.39-ndb-6.3.28) (pib:11)
[1 Oct 2009 7:25] Bugs System
Pushed into 5.1.39-ndb-7.0.9 (revid:jonas@mysql.com-20091001072547-kv17uu06hfjhgjay) (version source revid:jonas@mysql.com-20091001071652-irejtnumzbpsbgk2) (merge vers: 5.1.39-ndb-7.0.9) (pib:11)
[1 Oct 2009 13:25] Bugs System
Pushed into 5.1.39-ndb-7.1.0 (revid:jonas@mysql.com-20091001123013-g9ob2tsyctpw6zs0) (version source revid:jonas@mysql.com-20091001123013-g9ob2tsyctpw6zs0) (merge vers: 5.1.39-ndb-7.1.0) (pib:11)
[5 Oct 2009 10:50] Bugs System
Pushed into 5.1.39-ndb-6.2.19 (revid:jonas@mysql.com-20091005103850-dwij2dojwpvf5hi6) (version source revid:jonas@mysql.com-20090930185117-bhud4ek1y0hsj1nv) (merge vers: 5.1.39-ndb-6.2.19) (pib:11)
[8 Oct 2009 20:34] Paul Dubois
The 5.4 fix has been pushed to 5.4.3.