Bug #24841 Shared-memory client-connections fail on windows vista
Submitted: 5 Dec 2006 23:54 Modified: 6 Dec 2006 7:35
Reporter: Armin Schöffmann (OCA) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:mysql-5.0.32-nightly-20061205 OS:Windows (Windows Vista X86 RTM & slimmer)
Assigned to: CPU Architecture:Any
Tags: vista

[5 Dec 2006 23:54] Armin Schöffmann
Description:
A mysql-client can't open a shared-memory-connection if run under windows vista.
Identical behaviour on winxp/srv2003/win2k if the connection attempt is made from within a windows-session other than zero (e.g. a remote-desktop-session).

How to repeat:
start the mysql-daemon with shared-memory enabled.

*********************************************************************
* windows vista
*********************************************************************
C:\Programme\mysql\bin>mysql --protocol=memory -hlocalhost -uroot

ERROR 2038 (HY000): Can't open shared memory; client could not create request ev
ent (2)

C:\Programme\mysql\bin>ver

Microsoft Windows [Version 6.0.6000]

SESSIONNAME=console

*********************************************************************
* windows server 2003
*********************************************************************
X:\program files\mysql\bin>mysql --protocol=memory -hlocalhost -uroot

ERROR 2038 (HY000): Can't open shared memory; client could not create request ev
ent (2)

X:\program files\mysql\bin>ver

Microsoft Windows [Version 5.2.3790]

SESSIONNAME=RDP-Tcp#1

Suggested fix:
Whereas XP/2k assigns session zero to the first logged on user, Windows Vista, reserves session 0 for system processes. The first user to log on is given a session ID number of one (1) even if this is the console.

The shared-memory-protocol relies on global named (event/filemapping)-objects created by the server process.

From win-sessions other than 0, named (event)objects need to be prefixed with the  "Global\"-tag to form a valid object-name:

client.c
HANDLE create_shared_memory(MYSQL *mysql,NET *net, uint connect_timeout)

instead of
OpenEvent(event_access_rights, FALSE, "MYSQL_CONNECT_REQUEST")

we need
OpenEvent(event_access_rights, FALSE, "Global\\MYSQL_CONNECT_REQUEST")

same for OpenFileMapping

:-)
armin.
[6 Dec 2006 7:35] Sveta Smirnova
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments to the original bug instead.

Thank you for your interest in MySQL.

Duplicates bug #24731.
[6 Dec 2006 7:36] Sveta Smirnova
I added link to your patch to original bug report.