You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by GitBox <gi...@apache.org> on 2021/11/06 10:11:02 UTC

[GitHub] [qpid-dispatch] jiridanek commented on pull request #1425: DISPATCH-2103 Log actual HTTP listener port number when 0 is configured

jiridanek commented on pull request #1425:
URL: https://github.com/apache/qpid-dispatch/pull/1425#issuecomment-962428886


   I'll try to explain the steps that got me to put in
   
   ```c
   #ifdef QD_HAVE_MODERN_LIBWEBSOCKETS
       info.finalize = finalize_http;
       info.finalize_arg = hl;
   #endif
   ```
   
   # Without touching this at all, qd_listener_t is sometimes not decrefed in http listener test
   
   # I came to believe this is because `qd_lws_listener_free` in `http_handler` is sometimes not called (This only happens on Ubuntu)
   
   ```c
       switch (reason) {
       case LWS_CALLBACK_PROTOCOL_DESTROY:
           qd_lws_listener_free(wsi_listener(wsi));
           break;
         default:
           break;
       }
   ```
   
   https://github.com/jiridanek/qpid-dispatch/runs/4116448428?check_suite_focus=true#step:9:41
   
   ```
   78: refcount is 2
   78: refcount is 1
   78: refcount is 0; freed
   78: refcount is 2
   78: refcount is 1
   78: refcount is 0; freed
   78: refcount is 2
   78: ===============================================================================
   78: ../tests/c_unittests/test_listener_startup.cpp:126:
   78: TEST CASE:  Start HTTP listener with zero port
   78: 
   78: ../tests/c_unittests/test_listener_startup.cpp:126: FATAL ERROR: test case CRASHED: SIGABRT - Abort (abnormal termination) signal
   ```
   
   
   # If I instead change http_handler ro respond to LWS_CALLBACK_WSI_DESTROY, I  get use after free when logging vhost name
   
   ```
       switch (reason) {
       case LWS_CALLBACK_WSI_DESTROY:
           qd_lws_listener_free(wsi_listener(wsi));
           break;
       default:
           break;
       }
   ```
   
   https://github.com/jiridanek/qpid-dispatch/runs/4117408625?check_suite_focus=true#step:9:42
   
   ```
   8: refcount is 2
   78: refcount is 1
   78: refcount is 0; freed
   78: refcount is 2
   78: refcount is 1
   78: refcount is 0; freed
   78: =================================================================
   78: ==2802==ERROR: AddressSanitizer: heap-use-after-free on address 0x602000019210 at pc 0x7f89ee3cbdbb bp 0x7f89e81fc510 sp 0x7f89e81fbc88
   78: READ of size 2 at 0x602000019210 thread T5
   78:     #0 0x7f89ee3cbdba  (/lib/x86_64-linux-gnu/libasan.so.5+0x9cdba)
   78:     #1 0x7f89ee3cf255 in __vsnprintf_chk (/lib/x86_64-linux-gnu/libasan.so.5+0xa0255)
   78:     #2 0x7f89eda41eb3 in _lws_logv (/lib/x86_64-linux-gnu/libwebsockets.so.15+0x10eb3)
   78:     #3 0x7f89eda41fa7 in _lws_log (/lib/x86_64-linux-gnu/libwebsockets.so.15+0x10fa7)
   78:     #4 0x7f89eda4843d  (/lib/x86_64-linux-gnu/libwebsockets.so.15+0x1743d)
   78:     #5 0x7f89eda436c8  (/lib/x86_64-linux-gnu/libwebsockets.so.15+0x126c8)
   78:     #6 0x7f89eda3fcaa in lws_context_destroy (/lib/x86_64-linux-gnu/libwebsockets.so.15+0xecaa)
   78:     #7 0x559501500e2b in qd_http_server_free ../src/http-libwebsockets.c:982
   78:     #8 0x5595012dbd81 in qd_dispatch_free ../src/dispatch.c:369
   78:     #9 0x559501621c35 in QDR::deinitialize(bool) const ../tests/c_unittests/./helpers.hpp:265
   78:     #10 0x559501611bd9 in check_http_listener_startup_log_message(qd_server_config_t, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) ../tests/c_unittests/test_listener_startup.cpp:82
   78:     #11 0x55950161402b in operator() ../tests/c_unittests/test_listener_startup.cpp:133
   78:     #12 0x55950161adae in __invoke_impl<void, _DOCTEST_ANON_FUNC_24()::<lambda()> > /usr/include/c++/9/bits/invoke.h:60
   78:     #13 0x55950161a869 in __invoke<_DOCTEST_ANON_FUNC_24()::<lambda()> > /usr/include/c++/9/bits/invoke.h:95
   78:     #14 0x55950161a446 in _M_invoke<0> /usr/include/c++/9/thread:244
   78:     #15 0x55950161a0dc in operator() /usr/include/c++/9/thread:251
   78:     #16 0x559501619a8e in _M_run /usr/include/c++/9/thread:195
   78:     #17 0x7f89ed8fcde3  (/lib/x86_64-linux-gnu/libstdc++.so.6+0xd6de3)
   78:     #18 0x7f89ee315608 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x9608)
   78:     #19 0x7f89ecc7f292 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x122292)
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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