Bug #35751 ndb_mgm and other mgmapi clients hang on OS X 10.5 intel
Submitted: 1 Apr 2008 18:50 Modified: 10 Sep 2009 15:43
Reporter: [ name withheld ] Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S2 (Serious)
Version:mysql-5.1 OS:MacOS
Assigned to: Magnus Blåudd CPU Architecture:Any

[1 Apr 2008 18:50] [ name withheld ]
Description:
On a macbook, for instance, simple ndb_mgm commands like "show" and "shutdown" do not work.   

How to repeat:
start a cluster
run ndb_mgm
show
[1 Apr 2008 20:20] Sveta Smirnova
Thank you for the report.

I can not repeat same behavior on own 32-bit MacBook. Please indicate if your machine is 64-bit or 32-bit, accurate version of MySQL and provide your Cluster and mysqld configuration files.
[1 Apr 2008 20:51] [ name withheld ]
cluster.ini file for bug 35751

Attachment: cluster.ini (, text), 398 bytes.

[1 Apr 2008 20:55] [ name withheld ]
I am not sure, but I think all Macbooks are 32-bit.
Mine is running 10.5.2 but I have seen this problem with all 10.5 releases.
I have attached a cluster ini file.  Here is the procedure:
  Install from mysql-5.1.23-rc-osx10.5-x86.tar.gz
  mkdir ndb 
  bin/ndb_mgmd -f cluster.ini 
  bin/ndbd 

After this, if you run ndb_mgm and type "show", it hangs indefinitely.
However, if you try "ndb_mgm --execute=show" the command is succesful.
[1 Apr 2008 21:15] John David Duncan
jdd$ bin/ndb_mgm
-- NDB Cluster -- Management Client --
ndb_mgm> 
ndb_mgm> show
Warning, event thread startup failed, degraded printouts as result, errno=36

^C
[1 Apr 2008 21:18] John David Duncan
Apple crash report file

Attachment: ndb_mgm_2008-04-01-114319_Sam.crash (, text), 4.71 KiB.

[1 Apr 2008 21:20] John David Duncan
Sorry, please ignore that crash report file.  That's from the wrong binary.
[1 Apr 2008 21:26] John David Duncan
Here is a backtrace while the client is frozen:

Attaching to program: `/Users/jdd/mysql-builds/mysql-5.1.23-rc-osx10.5-x86/bin/ndb_mgm', process 662.
Reading symbols for shared libraries +++. done
0x90168b3a in select$DARWIN_EXTSN ()
(gdb) bt
#0  0x90168b3a in select$DARWIN_EXTSN ()
#1  0x0003c748 in my_sleep ()
#2  0x00013cd3 in NdbSleep_MilliSleep ()
#3  0x00002f5d in CommandInterpreter::connect ()
#4  0x00006786 in CommandInterpreter::execute_impl ()
#5  0x0000728e in Ndb_mgmclient::execute ()
#6  0x000020c3 in read_and_execute ()
#7  0x00002302 in main ()
(gdb)
[2 Apr 2008 17:46] Tobias Asplund
This happens only on Leopard, a workaround is to use 127.0.0.1 instead of localhost for the local entries.
[30 Sep 2008 17:06] Josh Nudell
I am working with Mac Mini's running Mac OS X 10.5.5.

My config file is as follows:
--- BEGIN CONFIG.INI ---
[ndbd default]    
NoOfReplicas=2    # Number of replicas
[tcp default]     
# Management process options:
[ndb_mgmd]                      
hostname=192.168.10.10           # Hostname or IP address of MGM node
datadir=/var/lib/mysql-cluster  # Directory for MGM node log files

# Options for data node "A":
[ndbd]                          
hostname=192.168.10.11          # Hostname or IP address
datadir=/var/lib/mysql-cluster  # Directory for this data node's data files

# Options for data node "B":
[ndbd]                          
hostname=192.168.10.12          # Hostname or IP address
datadir=/var/lib/mysql-cluster  # Directory for this data node's data files

# SQL node options:
[mysqld]                        
[mysqld]                        
--- END CONFIG.INI ---

I have the same issue, where commands issued from the interactive prompt (ndb_mgm> ) hang with the following printout:
warning, event thread startup failed, degraded printouts as result, errno=36

However, the ndb_mgm -e <command> works fine.

Is there a fix for the issue in OS X 10.5.5?

Thanks,

  -Josh
[7 Sep 2009 19:27] Magnus Blåudd
Calling gethostbyname requires a lot of stack and since we start the event thread with only 32k it will get a ECX_BADACCESS( aka SIGBUS) when the stack is overwritten deep down in the call stack.

We do allocate some large buffers on the stack, I can count up to 3,5k easily. But that is still far from the 32k we have asked for.

Fortunately the stack or the event thread can be doubled easily and then it works.

=== modified file 'storage/ndb/src/mgmclient/CommandInterpreter.cpp'
--- storage/ndb/src/mgmclient/CommandInterpreter.cpp	2009-05-27 15:21:45 +0000
+++ storage/ndb/src/mgmclient/CommandInterpreter.cpp	2009-09-07 19:22:52 +0000
@@ -1009,7 +1009,7 @@
       p.p= &m_print_mutex;
       m_event_thread = NdbThread_Create(event_thread_run,
                                         (void**)&p,
-                                        32768,
+                                        2*32768,
                                         "CommandInterpreted_event_thread",
                                         NDB_THREAD_PRIO_LOW);
       if (m_event_thread)
[7 Sep 2009 19:29] Magnus Blåudd
The above patch is a quick fix, we should move to use the modern getaddrinfo functon on all platforms http://developer.apple.com/iphone/library/documentation/System/Conceptual/ManPages_iPhoneO...
[7 Sep 2009 20:31] Magnus Blåudd
Calling 'getaddrinfo' requires just as much stack...
[8 Sep 2009 9:53] 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/82657
[9 Sep 2009 15:19] Magnus Blåudd
Pushed the fix that increases default stack size to 64k for most threads to 6.2, 6.3, 7.0 and 7.1
[10 Sep 2009 15:43] Jon Stephens
Documented bugfix in the NDB-6.2.19, 6.3.27, and 7.0.8 changelogs as follows:

        On Mac OS X 10.5, commands entered in the management client
        failed and sometimes caused the client to hang, although
        management client commands invoked using the --execute (or
        -e) option from the system shell worked normally.

Closed.