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:
None 
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

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

ndbClusterConnection = new Ndb_cluster_connection(_connectString.c_str());
ndbClusterConnection->set_optimized_node_selection(0);

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);