Uncaught DevFailed exception in DeviceProxy destructor in cxx_stateless_subscription testcase
Hello, I got following error every time I run stateless_subscription testcase:
38: terminate called after throwing an instance of 'Tango::DevFailed'
1/1 Test #38: CXX::cxx_stateless_subscription ...Child aborted***Exception: 55.67 sec
I'm using:
- cppTango tango-9-lts, 07eea094
- gcc 8.2.1 20181127
- libzmq built from tag v4.3.0
DevFailed
is being thrown in device2
destructor:
https://github.com/tango-controls/cppTango/blob/07eea09441aba365e17b077347797e1f8ab04c91/cpp_test_suite/new_tests/cxx_stateless_subscription.cpp#L88-L95
The root cause of the exception is disconnect
failure in heartbeat socket:
errno is being set to ENOENT. This means that given endpoint was already disconnected. Indeed SUB socket is disconnected when PUB endpoint is terminated (kill_server
call).
The workaround is to delete device2
proxy before kill_server
is called.
A proper fix would be to handle disconnection failure (at least the one due to ENOENT) in zmqeventconsumer.cpp. I can submit a patch if you're ok with such a solution.
Probably there are other scenarios where exception can be thrown in a destructor. Such exception will always result in a call to terminate
(as destructor is implicitly noexcept
).