Bug #32529 libndclient should not exit() but rather return an error to the application
Submitted: 20 Nov 2007 15:10
Reporter: Axel Schwenke Email Updates:
Status: Verified Impact on me:
Category:MySQL Cluster: NDB API Severity:S4 (Feature request)
Version:mysql-5.1-telco--6.3 OS:Any
Assigned to: CPU Architecture:Any
Tags: 5.1.22-ndb-6.3.6
Triage: Triaged: D5 (Feature request)

[20 Nov 2007 15:10] Axel Schwenke
SMPS_OUT << "MysCluster::openConnection(" << _connectString << ") Create a new connection" << endl;
Ndb_cluster_connection* ndbClusterConnection;

ndbClusterConnection = new Ndb_cluster_connection(_connectString.c_str());

int res = ndbClusterConnection->connect(3, 1);
SMPS_OUT << "MysCluster::openConnection(" << _connectString << ")" << " : after connect result " << res << endl;

res = ndbClusterConnection->wait_until_ready(MysCluster::_clusterConnectionTimeout, 0);
SMPS_OUT << "MysCluster::openConnection(" << _connectString << ")" << " : after wait_until_ready" << endl;

is terminated by a call to exit() in libndbapi (in TransporterFacade::threadMainSend(void)) if the cluster is started at the same time than the application.

How to repeat:
see associated support issue for details

Suggested fix:
libndbclient should not call exit() in case of an error but instead signal the error condition to the application.
[21 Nov 2007 18:26] Hartmut Holzgraefe
In 5.1 exit() is used at the following places within ndbapi source:

./NdbEventOperationImpl.cpp:295:    exit(-1);
./NdbEventOperationImpl.cpp:308:    exit(-1);
./NdbEventOperationImpl.cpp:341:        exit(-1);
./NdbEventOperationImpl.cpp:1004:    exit(-1);
./Ndbinit.cpp:118:      exit(-1);
./TransporterFacade.cpp:459:    exit(0);