Bug #61885 MySQL server shutdown with named pipes
Submitted: 16 Jul 2011 11:38 Modified: 9 Jan 2013 2:36
Reporter: Сергей Петров Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Windows Severity:S3 (Non-critical)
Version:5.5.14 OS:Windows (Seven SP1)
Assigned to: CPU Architecture:Any

[16 Jul 2011 11:38] Сергей Петров
Description:
MySQL server does not shutdown properly if run server with named pipe what already in use.

How to repeat:
Open three console windows
1:

mysqld --console --datadir=.\Test\DB1 --enable-named-pipe --socket=Test --port 10001

2:

mysqld --console --datadir=.\Test\DB2 --enable-named-pipe --socket=Test --port 10002

3:

mysqladmin --port=10002 --user=root shutdown

Now server on console 2 write "Shutdown complete", but mysqld process not ended.

mysqladmin --port=10001 --user=root shutdown

Now server on console 2 ended and server on console 1 write "Shutdown complete", but mysqld process not ended.
[16 Jul 2011 22:35] MySQL Verification Team
Thank you for the bug report. Looks for me that's not a shutdown issue instead is the second instance was allowed to start using a named pipe already created by first instance (Test). Starting the 2nd server instance with a named pipe called i.e: Test2 the shutdown of both instances is performed with success. If you agree, could you please change the synopsis that you can start multiples server with the same named pipe. Thanks in advance.
[17 Jul 2011 11:40] Сергей Петров
I am just accidentally run second instance of MySQL server with same named pipe and I am can not properly shutdown that server instance. mysqld is still present in process list and I am have to kill in through task manager. Becouse of that, I am call this shutdown bug. As for me, it is no matter as it called. I am just want, what server can be shutdown properly in any case.
[18 Jul 2011 12:16] MySQL Verification Team
Shutdown server

Attachment: named_pipe_shutdown.png (image/png, text), 197.05 KiB.

[18 Jul 2011 12:19] MySQL Verification Team
Could you please see prior attached picture. You can see when using different named pipe (Test/Test2) there is not problem with shutdown. I used the pslist tool to list the MySQL server process before and after mysqladmin shutdown actions.
[18 Jul 2011 12:33] Сергей Петров
You say "MySQL correctly handle situations when it correctly used". I do not deny that, but I am say other thing "MySQL incorrectly handle situations when it incorrectly used", and I am want that "MySQL correctly handle situations when it incorrectly used".
[18 Jul 2011 15:42] MySQL Verification Team
I can repeat the hang  at shutdown.  There are two threads waiting for something, below are their stack traces:

ntdll.dll!_ZwWaitForSingleObject@12()
kernel32.dll!_WaitForSingleObjectEx@12()
kernel32.dll!_WaitForSingleObject@8()
mysqld.exe!handle_connections_shared_memory(void * arg=0x00000000)  Line 5573	
mysqld.exe!pthread_start(void * p=0x035c4788)  Line 61
mysqld.exe!_callthreadstartex()  Line 348
mysqld.exe!_threadstartex(void * ptd=0x035e6aa0)  Line 326
kernel32.dll!_BaseThreadStart@8()

ntdll.dll!_ZwWaitForMultipleObjects@20()
kernel32.dll!_WaitForMultipleObjectsEx@20()
kernel32.dll!_WaitForMultipleObjects@16()
mysqld.exe!legacy_cond_timedwait  Line 191
mysqld.exe!pthread_cond_timedwait Line 318
mysqld.exe!handle_connections_methods()  Line 4219
mysqld.exe!mysql_service  Line 4717
mysqld.exe!mysqld_main Line 4911
mysqld.exe!__tmainCRTStartup()  Line 266
kernel32.dll!_BaseProcessStart@4()
[18 Jul 2011 15:55] MySQL Verification Team
I am able to repeat only using the same --socket=Test named pipe, but how I mentioned before that's the bug the second server instance could be aborted with the error message that name pipe is already in use.
[18 Jul 2011 23:03] Vladislav Vaintroub
@Shane, second thread in your example is waiting for the first thread to finish.

the first thread on some reason waits for shared memory, even if the example was for named pipes ;)
[9 Jan 2013 2:36] Philip Olson
Fixed as of the upcoming MySQL Server 5.7, and here's the changelog entry:

It was possible to specify a "Named Pipe" that was already in use. This
is no longer allowed, as an error is now emitted and the process is
aborted. After "mysqld.exe" was started in Named Pipe mode with a pipe
name that was already used by a different instance, neither instance was
able to shut down properly when a shutdown command was received from a
"TCP" socket in any of the processes. Therefore, "mysqld.exe" was not
terminated.

Thank you for the bug report.