Bug #47712 ndb_mgm_connect returns ok but connection is not working
Submitted: 29 Sep 2009 14:41
Reporter: Magnus Blaudd
Status: Verified
Category:Server: Cluster Severity:S3 (Non-critical)
Version:mysql-5.1-telco-6.3 OS:Any
Assigned to: Magnus Blaudd Target Version:6.3.28
Tags: 6.3.27
Triage: Triaged: D4 (Minor) / R6 (Needs Assessment) / E6 (Needs Assessment)

[29 Sep 2009 14:41] Magnus Blaudd
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 15:02] Magnus Blaudd
In this case you get a timeout when trying to run the next command.
[8 Jan 11: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.