Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
proton-c-0.18.1
-
None
Description
In the following test, what now seems to be happening is that the container exits before the scheduled task is executed. Therefore, no exception is thrown.
class MyException : public std::exception {}; struct exception_from_scheduled_tester : public proton::messaging_handler { proton::listener listener; test_port port; bool should_stop; explicit exception_from_scheduled_tester(bool should_stop) : should_stop(should_stop) {} void on_container_start(proton::container& c) PN_CPP_OVERRIDE { listener = c.listen(port.url()); c.connect(port.url("localhost")); c.schedule(proton::duration(250), [this]() { throw MyException(); }); if (should_stop) { c.stop(); } } }; int test_container_scheduled_throws_exception() { exception_from_scheduled_tester t(/*should_stop*/ true); // test would pass if this is set to false proton::container c(t); try { c.run(); FAIL("expected exception"); } catch (proton::error &e) { // expected } // t.listener.stop(); // uh, why am I not supposed to call this here? return 0; }
According to git bisect, the commit that changed the behavior (flipped the test from pass to fail) is
% git bisect bad 6e41df90023cfc06f4bc9ad7b972e9b39284980a is the first bad commit commit 6e41df90023cfc06f4bc9ad7b972e9b39284980a Author: Alan Conway <aconway@redhat.com> Date: Mon Oct 23 17:24:10 2017 +0100 PROTON-1628: [cpp] Stopping container in on_container_start will hang Check if already stopping before entering the event loop in container::impl::thread() :040000 040000 ffad13af832b4c8c9b15a75a146ba1cec302492f 4bde1331bba40d477eefa383d78a95d49a291a90 M proton-c
Attachments
Issue Links
- blocks
-
PROTON-1676 Check that scheduled tasks are executed, despite closed connection or stopped container
- Open
- relates to
-
PROTON-1628 [cpp] Stopping container in on_container_start will hang
- Closed