Exception in init_device() blocks server
Throwing an exception in my device server in the device init_device():
void TangoTest::init_device() {
throw "error!";
}
blocks if I my main() looks like this:
int main(int argc, char *argv[]) {
Tango::Util *util = NULL;
try {
util = Tango::Util::init(argc,argv);
util->server_init(false);
cout << "Ready to accept request" << endl;
util->server_run();
} catch (...) {
cout << "Received an unknown exception" << endl;
cout << "Exiting" << endl;
}
util->server_cleanup();
delete util;
return(0);
}
The difference from a pogo generated server is that I properly call the delete util.
I notice the server is blocked in the Util::~Util() destructor. It looks like it is waiting for the Polling thread. Seems like a dead lock to me.
In cases where the server stops orderly there seems to be no problem in calling Util::~Util().
I report this because in PyTango I notice the same behaviour. In PyTango, the python Util object calls the underlying C++ Util destructor automatically so if the init_device() throws an exception, PyTango servers always block.
Edited by Reynald Bourtembourg