Bug #41190 shared memory connections do not work in Vista, if server started from cmdline
Submitted: 2 Dec 2008 23:56 Modified: 28 Jun 2009 1:06
Reporter: Vladislav Vaintroub Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:6.0 OS:Microsoft Windows (Vista)
Assigned to: Vladislav Vaintroub
Triage: Triaged: D3 (Medium) / R2 (Low) / E2 (Low)

[2 Dec 2008 23:56] Vladislav Vaintroub
Description:
Attempt to use --protocol=memory fails, even if server is started with shared memory support from command line.

How to repeat:
1.start server from command line with --shared-memory
2.start client with --protocol=memory.

G:\bzr\wtf2\mysql-test>..\client\debug\mysql.exe -uroot --protocol=memory
ERROR 2038 (HY000): Can't open shared memory; client could not create request ev
ent (0)

Suggested fix:
The problem is the mismatch for kernel object names used by client and server.

What happens:
- client is looking for Global\MYSQL_CONNECT_REQUEST event.
- server is opening session specific event with the name \Sessions\1\BaseNamedObjects\MYSQL_CONNECT_REQUEST
This name mismatch also applies to shared memory objects.

Fix would be to use prefix "\Global" for event and shared memory names, when server creates the objects.

Note that in this case, mysqld.exe that started in user session would needs CreateGlobalObjects privilege. 
On Vista with UAC, this can be accomplished e.g by running mysqld.exe in elevated command line window.

If mysqld.exe runs as service, no changes are necessary, shared memory is global anyway.
[3 Dec 2008 0:04] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/60437

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.
[16 May 2009 20:20] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/74292

3283 Vladislav Vaintroub	2009-05-16
      Bug #41190 shared memory connections do not work in Vista, if server started from cmdline 
      
      In Vista and later and also in when using terminal services, when server is started from
      command line, client cannot connect to it via shared memory protocol.
      
      This is a regression introduced when  Bug#24731 was fixed.
      The reason is that client is trying to attach to shared memory using global kernel object
      namespace (all kernel objects are prefixed with Global\). However, server started from 
      the command line in Vista and later will create shared memory and events using current
      session namespace. Thus, client is unable to find the server and connection fails.
      
      The fix for the client is to first try to find server using "local" names  (omitting  Global\
      prefix) and only if server is not found, trying global namespace.
[16 May 2009 20:38] Vladislav Vaintroub
New commit fixes bug differently and allows using session namespace for server kernel objects. SeCreateGlobalPrivilege/running elevated on Vista is no more required for the test suite.
[18 May 2009 20:31] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/74417

3297 Vladislav Vaintroub	2009-05-18
      Bug #41190 shared memory connections do not work in Vista, if server started 
      from cmdline 
            
      In Vista and later and also in when using terminal services, when server is started
      from  command line, client cannot connect to it via shared memory protocol.
            
      This is a regression introduced when  Bug#24731 was fixed.
      The reason is that client is trying to attach to shared memory using global kernel
      object  namespace (all kernel objects are prefixed with Global\). However, server 
      started from the command line in Vista and later will create shared memory and 
      events using current  session namespace. Thus, client is unable to find the server
      and connection fails.
            
      The fix for the client is to first try to find server using "local" names  (omitting
      Global\  prefix) and only if server is not found, trying global namespace.
[10 Jun 2009 14:00] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/76026

2769 Davi Arnaut	2009-06-10
      Bug#41190: shared memory connections do not work in Vista, if server started from cmdline
      
      Backport to MySQL 5.0/1 fix by Vladislav Vaintroub:
      
      In Vista and later and also in when using terminal services, when
      server is started from  command line, client cannot connect to it
      via shared memory protocol.
      
      This is a regression introduced when  Bug#24731 was fixed.  The
      reason is that client is trying to attach to shared memory using
      global kernel object  namespace (all kernel objects are prefixed
      with Global\). However, server started from the command line in
      Vista and later will create shared memory and events using current
      session namespace. Thus, client is unable to find the server and
      connection fails.
      
      The fix for the client is to first try to find server using "local"
      names  (omitting Global\  prefix) and only if server is not found,
      trying global namespace.
[10 Jun 2009 14:01] Davi Arnaut
Queued to 5.0-bugteam and up
[16 Jun 2009 8:32] Bugs System
Pushed into 5.0.84 (revid:gkodinov@mysql.com-20090616082753-kwe0l8uoictxhojf) (version source revid:davi.arnaut@sun.com-20090610135959-qxcnown5oqkdhocj) (merge vers: 5.0.83) (pib:6)
[16 Jun 2009 11:04] Bugs System
Pushed into 5.1.36 (revid:joro@sun.com-20090616102155-3zhezogudt4uxdyn) (version source revid:davi.arnaut@sun.com-20090610140507-y7y7n931lbgnesb4) (merge vers: 5.1.36) (pib:6)
[17 Jun 2009 19:26] Bugs System
Pushed into 5.4.4-alpha (revid:alik@sun.com-20090616183122-chjzbaa30qopdra9) (version source revid:davi.arnaut@sun.com-20090610142446-5sznm24ozsl95nfn) (merge vers: 5.4.4-alpha) (pib:11)
[28 Jun 2009 1:06] Paul Dubois
Noted in 5.0.84, 5.1.36, 5.4.4 changelogs.

Shared-memory connections did not work in Vista if mysqld was started
from the command line.
[12 Aug 2009 22:48] Paul Dubois
Noted in 5.4.2 changelog because next 5.4 version will be 5.4.2 and not 5.4.4.
[15 Aug 2009 2:03] Paul Dubois
Ignore previous comment about 5.4.2.
[26 Aug 2009 13:45] Bugs System
Pushed into 5.1.37-ndb-7.0.8 (revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (version source revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (merge vers: 5.1.37-ndb-7.0.8) (pib:11)
[26 Aug 2009 13:46] Bugs System
Pushed into 5.1.37-ndb-6.3.27 (revid:jonas@mysql.com-20090826105955-bkj027t47gfbamnc) (version source revid:jonas@mysql.com-20090826105955-bkj027t47gfbamnc) (merge vers: 5.1.37-ndb-6.3.27) (pib:11)
[26 Aug 2009 13:48] Bugs System
Pushed into 5.1.37-ndb-6.2.19 (revid:jonas@mysql.com-20090825194404-37rtosk049t9koc4) (version source revid:jonas@mysql.com-20090825194404-37rtosk049t9koc4) (merge vers: 5.1.37-ndb-6.2.19) (pib:11)
[27 Aug 2009 16:32] Bugs System
Pushed into 5.1.35-ndb-7.1.0 (revid:magnus.blaudd@sun.com-20090827163030-6o3kk6r2oua159hr) (version source revid:jonas@mysql.com-20090826132541-yablppc59e3yb54l) (merge vers: 5.1.37-ndb-7.0.8) (pib:11)
[8 Oct 2009 19:38] Paul Dubois
The 5.4 fix has been pushed to 5.4.2.