[
https://issues.apache.org/jira/browse/DISPATCH-2103?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17439643#comment-17439643
]
ASF GitHub Bot commented on DISPATCH-2103:
------------------------------------------
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
> Log the actual HTTP websocket listener port when 0 was specified in config
> --------------------------------------------------------------------------
>
> Key: DISPATCH-2103
> URL: https://issues.apache.org/jira/browse/DISPATCH-2103
> Project: Qpid Dispatch
> Issue Type: New Feature
> Affects Versions: 1.15.0
> Reporter: Jiri Daněk
> Assignee: Jiri Daněk
> Priority: Major
> Fix For: 1.19.0
>
>
> {code}
> if (hl->vhost) {
> /* Store hl pointer in vhost */
> void *vp = lws_protocol_vh_priv_zalloc(hl->vhost, &protocols[0],
> sizeof(hl));
> memcpy(vp, &hl, sizeof(hl));
> qd_log(hs->log, QD_LOG_NOTICE, "Listening for HTTP on %s",
> config->host_port);
> return;
> } else {
> qd_log(hs->log, QD_LOG_NOTICE, "Error listening for HTTP on %s",
> config->host_port);
> goto error;
> }
> return;
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]