Bug #1552
Catching exceptions caused by failed socket transport initialization leads to crash
Status: | Resolved | Start date: | 06/26/2013 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | J. Moringen | % Done: | 100% | |
Category: | C++ | |||
Target version: | rsb-0.9 |
Description
#include <rsb/Factory.h>
int main() {
// first get a factory instance that is used to create RSB domain objects
rsb::Factory &factory = rsb::getFactory();
try {
// set up the scope to receive on either from the command line argument or
// use the default scope of the informer example
rsb::Scope scope = rsb::Scope("/dummy");
// create a listener that asynchronously receives events from the bus and
// dispatches them to registered handlers
rsb::ListenerPtr listener=factory.createListener(scope);
}
catch(...) {
;
}
}
rsb.conf
:
[qualityofservice]
reliability = UNRELIABLE
ordering = UNORDERED
[errorhandling]
onhandlererror = LOG
[transport.socket]
host = vitellius
port = 55555
enabled = 1 # this is the default
server=0
[transport.socket.converter]
image = IplImage # wireSchema = dataType
[transport.inprocess]
foo = barbar
factor = 1.5
enabled = 0
g++ weird_try_catch.cpp -I /media/local/hriechma/rsb/include/rsc0.9/ -I /media/local/hriechma/rsb/include/rsb0.9/ -L /media/local/hriechma/rsb/lib/ -l:librsb.so.0.9 -l:librsc0.9.so.0.9 -lboost_system
Ergebnis ist das beim Ausführen diese Ausgabe kommt:
a.out: /usr/include/boost/smart_ptr/shared_ptr.hpp:418: T* boost::shared_ptr<T>::operator->() const [with T = rsb::transport::socket::Bus]: Assertion `px != 0' failed. Aborted
Wenn man das try
catch
weglässt, kommt ein std::runtime_error
dass er nicht verbinden konnte. Mit dem try
catch
würde ich erwarten, dass gar keine Ausgabe kommt und das Programm sauber beendet wird.
Associated revisions
Fixed shared pointer deref in src/rsb/transport/socket/*Connector*.cpp
fixes #1552
- src/rsb/transport/socket/ConnectorBase.cpp (header): updated
copyright
(ConnectorBase::deactivate): check Bus shared_ptr before
dereferencing - src/rsb/transport/socket/InConnector.cpp (header): updated copyright
(InConnector::deactivate): check Bus shared_ptr before dereferencing - test/rsbtest_toplevel_catch.cpp: new file; contains body of
toplevel_catch test - CMakeLists.txt: added TOPLEVEL_CATCH_TEST_NAME
- test/CMakeLists.txt: added new test toplevel_catch
History
#1 Updated by J. Moringen almost 11 years ago
- Status changed from New to In Progress
- % Done changed from 0 to 30
#2 Updated by J. Moringen almost 11 years ago
- Assignee set to J. Moringen
#3 Updated by J. Moringen almost 11 years ago
- Status changed from In Progress to Resolved
- % Done changed from 30 to 100
Applied in changeset rsb-cpp|commit:fda3b25ab6b0ad36935b703f84164ef5db5732a6.