Bug #69063 ndbd does not propagate failure status when run as windows service
Submitted: 25 Apr 2013 8:32 Modified: 25 Apr 2013 13:57
Reporter: Sébastien Barré Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S2 (Serious)
Version:7.3.1 m2 OS:Microsoft Windows (Server 2008 R2 64-bit)
Assigned to: CPU Architecture:Any

[25 Apr 2013 8:32] Sébastien Barré
Description:
ndbd always terminates with SUCCESS status, even in the event of a failure.
(my setup is the same as here: http://bugs.mysql.com/bug.php?id=68224, although that is probably not important here)

That is especially annoying given windows uses the failure indication to decide that it should auto-restart the service (when the "auto-restart service on failure" windows feature is enabled).

How to repeat:
-Start the cluster
-unplug one ndb node from the network.
->It detects that it cannot reach its peer node, then tries to ask the mgm node for arbitration. Being unplugged, it cannot reach the mgm node either and so decides to terminate.
-the termination indicates success status so that a manual intervention is required after any network disruption.

Suggested fix:
On the Cluster mailing list, Magnus Blaudd has suggested a reason for this. I copy-paste his reply here as I think it can help solving the bug:
==========
 the intention is that you should be able to configure the service
 properties of Windows so that ndbd or ndb_mgmd is restarted if it fails.
 You seem to have done just that but apparently ndbd shuts down and
 return 0(for OK) so it does not work. In case this is a correct
 interpretation the ndbd need to be fixed to return an exit status
 indicating it "failed".

 The affected code for ndbd is in angel.cpp, ndbd.cpp and ndb_daemon.cc.
 The function ndb_daemon_exit(int code) is called which then calls
 g_ntsvc.Stop(), it looks like the "code" argument is never propagated to
 g_ntsvc to indicate that the process should exit with an error.
==========
[25 Apr 2013 13:57] Umesh Shastry
Hello Sébastien,

Thank you for the report.

Thanks,
Umesh