mirror of
https://github.com/MariaDB/server.git
synced 2026-04-27 02:35:29 +02:00
Bug#47571: idle named pipe connection is unkillable
Bug#31621: Windows server hanging during shutdown using named pipes
and idle connection
Problem: when idle pipe connection is forcefully closed with KILL
statement or when the server goes down, thread that is closing connection
would hang infinitely in CloseHandle(). The reason for the hang is that
named pipe operations are performed synchronously. In this mode all IOs
on pipe are serialized, that is CloseHandle() will not abort ReadFile()
in another thread, but wait for ReadFile() to complete.
The fix implements asynchrnous mode for named pipes, where operation of file
are not synchronized. Read/Write operation would fire an async IO and wait for
either IO completion or timeout.
Note, that with this patch timeouts are properly handled for named pipes.
Post-review: Win32 timeout code has been fixed for named pipes and shared
memory. We do not store pointer to NET in vio structure, only the read and
write timeouts.
This commit is contained in:
parent
bf711a743e
commit
84301e8b9d
6 changed files with 140 additions and 54 deletions
|
|
@ -389,7 +389,7 @@ HANDLE create_named_pipe(MYSQL *mysql, uint connect_timeout, char **arg_host,
|
|||
0,
|
||||
NULL,
|
||||
OPEN_EXISTING,
|
||||
0,
|
||||
FILE_FLAG_OVERLAPPED,
|
||||
NULL )) != INVALID_HANDLE_VALUE)
|
||||
break;
|
||||
if (GetLastError() != ERROR_PIPE_BUSY)
|
||||
|
|
@ -623,7 +623,7 @@ HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout)
|
|||
err2:
|
||||
if (error_allow == 0)
|
||||
{
|
||||
net->vio= vio_new_win32shared_memory(net,handle_file_map,handle_map,
|
||||
net->vio= vio_new_win32shared_memory(handle_file_map,handle_map,
|
||||
event_server_wrote,
|
||||
event_server_read,event_client_wrote,
|
||||
event_client_read,event_conn_closed);
|
||||
|
|
@ -2028,7 +2028,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
|
|||
}
|
||||
else
|
||||
{
|
||||
net->vio=vio_new_win32pipe(hPipe);
|
||||
net->vio= vio_new_win32pipe(hPipe);
|
||||
my_snprintf(host_info=buff, sizeof(buff)-1,
|
||||
ER(CR_NAMEDPIPE_CONNECTION), unix_socket);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue