MDEV-9366 : do_shutdown_server fails to detect server shutdown on Windows.
Fix test whether process is alive in mysqltest. Also fix SHUT_RD definition on Windows to be SD_RECEIVE. SD_BOTH was used instead prior to this patch, and this would occasionally make mysql_shutdown() fail - when the socket for the current connection is not able send the COM_SHUTDOWN response anymore.
This commit is contained in:
parent
1236333333
commit
3730d8a225
@ -5121,12 +5121,13 @@ static int my_kill(int pid, int sig)
|
|||||||
{
|
{
|
||||||
#ifdef __WIN__
|
#ifdef __WIN__
|
||||||
HANDLE proc;
|
HANDLE proc;
|
||||||
if ((proc= OpenProcess(PROCESS_TERMINATE, FALSE, pid)) == NULL)
|
if ((proc= OpenProcess(SYNCHRONIZE|PROCESS_TERMINATE, FALSE, pid)) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
if (sig == 0)
|
if (sig == 0)
|
||||||
{
|
{
|
||||||
|
DWORD wait_result= WaitForSingleObject(proc, 0);
|
||||||
CloseHandle(proc);
|
CloseHandle(proc);
|
||||||
return 0;
|
return wait_result == WAIT_OBJECT_0?-1:0;
|
||||||
}
|
}
|
||||||
(void)TerminateProcess(proc, 201);
|
(void)TerminateProcess(proc, 201);
|
||||||
CloseHandle(proc);
|
CloseHandle(proc);
|
||||||
|
@ -208,7 +208,7 @@ void vio_end(void);
|
|||||||
|
|
||||||
/* shutdown(2) flags */
|
/* shutdown(2) flags */
|
||||||
#ifndef SHUT_RD
|
#ifndef SHUT_RD
|
||||||
#define SHUT_RD SD_BOTH
|
#define SHUT_RD SD_RECEIVE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user