#At file:///G:/bzr/wtf2/
2682 Vladislav Vaintroub 2008-12-03
Bug#41190
Shared memory connection do not work in Vista
if mysqld is started from command line.
The reason is namespace mismatch for the event and shared memory objects.
* Client tries to open event and shared memory in global namespace, aka Session 0
(object names are prefixed with "\Global").
* Server creates them in the session namespace(i.e object names are prefixed
with \Sessions\1\ for example).
* The bug became apparent on Vista because Session 0 became isolated ,
reserved for services only (prior to Vista Session 0 was a normal console
session)
Solution is to use "\Global" prefix when creating events and shared memory.
modified:
sql-common/client.c
sql/mysqld.cc
per-file messages:
sql-common/client.c
Avoid vio_poll_read for shared memory and named pipe connections
- it will fail and cause connection to be aborted.
sql/mysqld.cc
- Use "Global\" prefix when creating events and shared memory
- improve error reporting (map windows error to posix error prior to sql_perror())
=== modified file 'sql-common/client.c'
--- a/sql-common/client.c 2008-10-22 11:51:28 +0000
+++ b/sql-common/client.c 2008-12-03 00:03:26 +0000
@@ -2128,6 +2128,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,cons
/* Get version info */
mysql->protocol_version= PROTOCOL_VERSION; /* Assume this */
if (mysql->options.connect_timeout &&
+ (net->vio->type == VIO_TYPE_TCPIP || net->vio->type == VIO_TYPE_SOCKET) &&
vio_poll_read(net->vio, mysql->options.connect_timeout))
{
set_mysql_extended_error(mysql, CR_SERVER_LOST, unknown_sqlstate,
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2008-11-24 15:30:37 +0000
+++ b/sql/mysqld.cc 2008-12-03 00:03:26 +0000
@@ -5452,7 +5452,7 @@ pthread_handler_t handle_connections_sha
shared_memory_base_name is unique value for each server
unique_part is unique value for each object (events and file-mapping)
*/
- suffix_pos= strxmov(tmp,shared_memory_base_name,"_",NullS);
+ suffix_pos= strxmov(tmp, "Global\\", shared_memory_base_name, "_", NullS);
strmov(suffix_pos, "CONNECT_REQUEST");
if ((smem_event_connect_request= CreateEvent(sa_event,
FALSE, FALSE, tmp)) == 0)
@@ -5511,8 +5511,8 @@ pthread_handler_t handle_connections_sha
unique_part is unique value for each object (events and file-mapping)
number_of_connection is connection-number between server and client
*/
- suffix_pos= strxmov(tmp,shared_memory_base_name,"_",connect_number_char,
- "_",NullS);
+ suffix_pos= strxmov(tmp, "Global\\", shared_memory_base_name, "_",
+ connect_number_char,"_",NullS);
strmov(suffix_pos, "DATA");
if ((handle_client_file_map=
CreateFileMapping(INVALID_HANDLE_VALUE, sa_mapping,
@@ -5597,14 +5597,16 @@ pthread_handler_t handle_connections_sha
continue;
errorconn:
- /* Could not form connection; Free used handlers/memort and retry */
if (errmsg)
{
+ my_osmaperr(GetLastError());
char buff[180];
strxmov(buff, "Can't create shared memory connection: ", errmsg, ".",
- NullS);
+ NullS);
sql_perror(buff);
}
+
+ /*Free used handlers/memory */
if (handle_client_file_map)
CloseHandle(handle_client_file_map);
if (handle_client_map)
@@ -5624,15 +5626,15 @@ errorconn:
/* End shared memory handling */
error:
- if (tmp)
- my_free(tmp, MYF(0));
-
if (errmsg)
{
+ my_osmaperr(GetLastError());
char buff[180];
strxmov(buff, "Can't create shared memory service: ", errmsg, ".", NullS);
sql_perror(buff);
}
+ if (tmp)
+ my_free(tmp, MYF(0));
my_security_attr_free(sa_event);
my_security_attr_free(sa_mapping);
if (handle_connect_map) UnmapViewOfFile(handle_connect_map);
| Thread |
|---|
| • bzr commit into mysql-6.0 branch (vvaintroub:2682) Bug#41190 | Vladislav Vaintroub | 3 Dec |