You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Justin Ross (JIRA)" <ji...@apache.org> on 2018/05/02 22:05:00 UTC

[jira] [Updated] (PROTON-1674) [cpp] Container does no longer wait for planned scheduled tasks

     [ https://issues.apache.org/jira/browse/PROTON-1674?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Justin Ross updated PROTON-1674:
--------------------------------
    Labels: test testing  (was: test)

> [cpp] Container does no longer wait for planned scheduled tasks
> ---------------------------------------------------------------
>
>                 Key: PROTON-1674
>                 URL: https://issues.apache.org/jira/browse/PROTON-1674
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: cpp-binding
>    Affects Versions: proton-c-0.18.1
>            Reporter: Jiri Daněk
>            Assignee: Justin Ross
>            Priority: Major
>              Labels: test, testing
>
> 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.
> {noformat}
> 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;
> }
> {noformat}
> According to git bisect, the commit that changed the behavior (flipped the test from pass to fail) is
> {noformat}
> % git bisect bad 
> 6e41df90023cfc06f4bc9ad7b972e9b39284980a is the first bad commit
> commit 6e41df90023cfc06f4bc9ad7b972e9b39284980a
> Author: Alan Conway <ac...@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
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org