Bug #35678 binlog settings ignored - and cause weirdness
Submitted: 30 Mar 2008 2:34 Modified: 2 Apr 2008 14:49
Reporter: Monty Taylor Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Replication Severity:S2 (Serious)
Version:mysql-5.1-telco-6.3 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: CGE-6.3

[30 Mar 2008 2:34] Monty Taylor
Description:
With MCCGE 6.3, when running mysqld with --bootstrap to setup tables and stuff, the server hangs if ndbcluster is enabled, that is, when it tries to shutdown, it hangs on a futex call while it tries to shut down the cluster binlog thread. 

Although this is problem enough, since it breaks the debian post-install scripts and mysql_install_db (both of which use mysqld --bootstrap) - it's a little bit worse... it does this even if log-bin is not enabled. 

How to repeat:
Install 6.3. Enable cluster in the my.cnf file. Run:

echo "select 1" | sudo strace /usr/sbin/mysqld --bootstrap --user=mysql --skip-grant-tables

You should see the server hang. 

If you run instead:

echo "select 1" | sudo strace /usr/sbin/mysqld --bootstrap --user=mysql --skip-grant-tables --skip-ndbcluste

You'll see it works successfully. 

turning log-bin on and off seems to be irrelevant. 

Suggested fix:
Well, for one, putting --loose-skip-ndbcluster into mysql_install_db is probably a good idea in general as a workaround. 

BUT - I would suggest: 

1) Don't start the cluster replication thread if binlogging isn't enabled... 

2) If it is enabled, don't hang on server shutdown during bootstrap. OR

3) Say that this will not work and have --bootstrap enable --skip-ndbcluster by default. (probably a good idea)
[4 Apr 2008 11:04] Geert Vanderkelen
Was running in the same problem just testing stuff. Wrote a new bug report, but then I was pointed to this one. So, I'm just writing up how I repeated it:

Simple configuration, any Cluster setup will do.

[mysqld]
user = mysql
datadir = /var/lib/mysql
server_id = 1
log_bin = cent01_bin
skip_innodb    # Important, or this will hang too..
ndbcluster
ndb_connectstring = localhost:1186

Now, start this once using mysqld_safe or directory using mysqld:
  shell> mysqld --defaults-file=/etc/mysql/my.cnf &

Start it a second time (should not do this, but let us suppose we forgot to change console fingers were to thick for the tiny buttons on the smartphone):
  shell> mysqld --defaults-file=/etc/mysql/my.cnf &

From the MySQL error log we learn:

..
080404 12:32:52 [Note] Plugin 'InnoDB' disabled by command line option
080404 12:32:52 [Note] Starting MySQL Cluster Binlog Thread
080404 12:32:52 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
080404 12:32:52 [ERROR] Do you already have another mysqld server running on port: 3306 ?
080404 12:32:52 [ERROR] Aborting

080404 12:32:53 [Note] Stopping Cluster Binlog

And on that last line it hangs. Doing an strace on the process:

Process 31304 attached - interrupt to quit
futex(0xd8d6c4, FUTEX_WAIT, 3, NULL