Jiri Daněk created PROTON-1674:
----------------------------------

             Summary: [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: Cliff Jansen
            Priority: Major


{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 <[email protected]>
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
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to