Uploaded image for project: 'Qpid Proton'
  1. Qpid Proton
  2. PROTON-1631

[cpp] Stopping container in on_container_start after opening a socket will hang with libuv io

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • proton-c-0.18.0
    • None
    • cpp-binding
    • None

    Description

      Make yourself a libuv build with

      cmake .. -DBUILD_GO=OFF -DCMAKE_BUILD_TYPE=Release -GNinja -DPROACTOR=libuv
      

      Run the following test

      struct less_immediate_stop_tester : public proton::messaging_handler {
          listen_port port;
          proton::listener listener;
          bool done;
          int scheduled_work;
      
          less_immediate_stop_tester() : done(false), scheduled_work(0) {}
      
          void connect(proton::container* c) {
          }
      
          void on_container_start(proton::container& c) PN_CPP_OVERRIDE {
              listener = c.listen(port.url());
              c.connect(port.url("localhost"));
              c.stop();
          }
      };
      
      // FIXME: this test has some Invalid reads in Valgrind  // with t.listener.stop() line commented out it doesn't
      int test_container_less_immediate_stop() {
          less_immediate_stop_tester t;
          proton::container c(t);
          c.run();
      //    t.listener.stop(); // saw this done in another test...
          return 0;
      }
      

      It will hang with the following output

      {nofornat}
      ninja && PN_TRACE_FRM=1 proton-c/bindings/cpp/container_test && echo pass
      [...]
      TEST: test_container_less_immediate_stop()
      [0x17cc4c0]: -> AMQP
      [0x17cc4c0]:0 -> @open(16) [container-id="e038fe4b-9996-4874-be7d-50274e1e193e", hostname="localhost", channel-max=32767]
      [0x17c9110]: <- AMQP
      [0x17c9110]:0 <- @open(16) [container-id="e038fe4b-9996-4874-be7d-50274e1e193e", hostname="localhost", channel-max=32767]
      [0x17c9110]: -> AMQP
      [0x17c9110]:0 -> @open(16) [container-id="e038fe4b-9996-4874-be7d-50274e1e193e", channel-max=32767]
      [0x17cc4c0]: <- AMQP
      [0x17cc4c0]:0 <- @open(16) [container-id="e038fe4b-9996-4874-be7d-50274e1e193e", channel-max=32767] {nofornat}

      Now, this exact code does not hang with epoll io.

      Attachments

        Activity

          People

            cliffjansen Clifford Jansen
            jdanek Jiri Daněk
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: