Bug #47712 ndb_mgm_connect returns ok but connection is not working
Submitted: 29 Sep 2009 12:41 Modified: 7 Apr 2014 13:03
Reporter: Magnus Blåudd Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:mysql-5.1-telco-6.3 OS:Any
Assigned to: Magnus Blåudd CPU Architecture:Any
Tags: 6.3.27

[29 Sep 2009 12:41] Magnus Blåudd
Description:
The function 'ndb_mgm_connect' may return 0(i.e no error) when it for example connect to a ndb_mgmd where 'accept' fails(for some reason). This will lead to a subsequent ndb_mgm_* function fails with timeout. 

How to repeat:
See testcase for bug#45497

Suggested fix:
Add a handshake phase in 'ndb_mgm_connect'. Since the server does not write a hello message, the client have to send womething that makes the server write something. Preferrably the already existing "get version" command should be used for this purpose since it will be backward compatible.

The handshake phase would detect this error condition when 'select' returns saying there is something to read, but there is 0 bytes to read ->  EOF.
[7 Oct 2009 13:02] Magnus Blåudd
In this case you get a timeout when trying to run the next command.
[8 Jan 2010 10:20] Jonas Oreland
Comment: Is this a bug?
Cause the ndb_mgm_handle can be made "obsolete" also after
a connect succeeds after using a handshake.

e.g
ndb_mgm_connect() -> returns OK
ndb_mgm_get_version() -> fails due to timeout

does it really matter if connect "incorrectly" returned OK
you have to check/handle every subsequent call anyway.
[7 Apr 2014 13:03] Magnus Blåudd
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php