Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leaks from http callbacks callback_healthz and callback_metrics #561

Closed
jiridanek opened this issue Jun 10, 2022 · 2 comments · Fixed by #562
Closed

Leaks from http callbacks callback_healthz and callback_metrics #561

jiridanek opened this issue Jun 10, 2022 · 2 comments · Fixed by #562
Assignees
Milestone

Comments

@jiridanek
Copy link
Contributor

jiridanek commented Jun 10, 2022

switch (reason) {

48: reason: 27 LWS_CALLBACK_PROTOCOL_INIT
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 27 LWS_CALLBACK_PROTOCOL_INIT
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 49 LWS_CALLBACK_HTTP_BIND_PROTOCOL
48: reason: 51 LWS_CALLBACK_CHECK_ACCESS_RIGHTS
48: reason: 50 LWS_CALLBACK_HTTP_DROP_PROTOCOL
48: reason: 49 LWS_CALLBACK_HTTP_BIND_PROTOCOL
48: reason: 12 LWS_CALLBACK_HTTP
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 16 LWS_CALLBACK_HTTP_WRITEABLE
48: reason: 50 LWS_CALLBACK_HTTP_DROP_PROTOCOL
48: reason: 5 LWS_CALLBACK_CLOSED_HTTP
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 49 LWS_CALLBACK_HTTP_BIND_PROTOCOL
48: reason: 51 LWS_CALLBACK_CHECK_ACCESS_RIGHTS
48: reason: 50 LWS_CALLBACK_HTTP_DROP_PROTOCOL
48: reason: 49 LWS_CALLBACK_HTTP_BIND_PROTOCOL
48: reason: 12 LWS_CALLBACK_HTTP
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 16 LWS_CALLBACK_HTTP_WRITEABLE
48: reason: 50 LWS_CALLBACK_HTTP_DROP_PROTOCOL
48: reason: 5 LWS_CALLBACK_CLOSED_HTTP
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 49 LWS_CALLBACK_HTTP_BIND_PROTOCOL
48: reason: 51 LWS_CALLBACK_CHECK_ACCESS_RIGHTS
48: reason: 50 LWS_CALLBACK_HTTP_DROP_PROTOCOL
48: reason: 49 LWS_CALLBACK_HTTP_BIND_PROTOCOL
48: reason: 12 LWS_CALLBACK_HTTP
48: reason: 49 LWS_CALLBACK_HTTP_BIND_PROTOCOL
48: reason: 51 LWS_CALLBACK_CHECK_ACCESS_RIGHTS
48: reason: 50 LWS_CALLBACK_HTTP_DROP_PROTOCOL
48: reason: 49 LWS_CALLBACK_HTTP_BIND_PROTOCOL
48: reason: 12 LWS_CALLBACK_HTTP
48: reason: 49 LWS_CALLBACK_HTTP_BIND_PROTOCOL
48: reason: 51 LWS_CALLBACK_CHECK_ACCESS_RIGHTS
48: reason: 50 LWS_CALLBACK_HTTP_DROP_PROTOCOL
48: reason: 49 LWS_CALLBACK_HTTP_BIND_PROTOCOL
48: reason: 12 LWS_CALLBACK_HTTP
48: reason: 49 LWS_CALLBACK_HTTP_BIND_PROTOCOL
48: reason: 51 LWS_CALLBACK_CHECK_ACCESS_RIGHTS
48: reason: 50 LWS_CALLBACK_HTTP_DROP_PROTOCOL
48: reason: 49 LWS_CALLBACK_HTTP_BIND_PROTOCOL
48: reason: 12 LWS_CALLBACK_HTTP
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 16 LWS_CALLBACK_HTTP_WRITEABLE
48: reason: 50 LWS_CALLBACK_HTTP_DROP_PROTOCOL
48: reason: 5 LWS_CALLBACK_CLOSED_HTTP
48: reason: 16 LWS_CALLBACK_HTTP_WRITEABLE
48: reason: 50 LWS_CALLBACK_HTTP_DROP_PROTOCOL
48: reason: 5 LWS_CALLBACK_CLOSED_HTTP
48: reason: 16 LWS_CALLBACK_HTTP_WRITEABLE
48: reason: 50 LWS_CALLBACK_HTTP_DROP_PROTOCOL
48: reason: 5 LWS_CALLBACK_CLOSED_HTTP
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 71 LWS_CALLBACK_EVENT_WAIT_CANCELLED
48: reason: 16 LWS_CALLBACK_HTTP_WRITEABLE
48: reason: 50 LWS_CALLBACK_HTTP_DROP_PROTOCOL
48: reason: 5 LWS_CALLBACK_CLOSED_HTTP
48: reason: 28 LWS_CALLBACK_PROTOCOL_DESTROY
48: reason: 28 LWS_CALLBACK_PROTOCOL_DESTROY
48: =================================================================
48: ==222674==ERROR: LeakSanitizer: detected memory leaks
48: 
48: Direct leak of 1152 byte(s) in 6 object(s) allocated from:
48:     #0 0x7f4a5feab077 in calloc (/lib64/libasan.so.8+0xba077)
48:     #1 0x56ae5e in qd_malloc /home/jdanek/repos/skupper-router/include/qpid/dispatch/ctools.h:221
48:     #2 0x56ae5e in callback_healthz /home/jdanek/repos/skupper-router/src/http-libwebsockets.c:771
48:     #3 0x7f4a5fda0fda in lws_http_action (/lib64/libwebsockets.so.19+0x4bfda)
48:     #4 0x7f4a5fda2e50 in lws_handshake_server (/lib64/libwebsockets.so.19+0x4de50)
48:     #5 0x7f4a5fda86e3 in lws_read_h1 (/lib64/libwebsockets.so.19+0x536e3)
48:     #6 0x7f4a5fda902f in rops_handle_POLLIN_h1.lto_priv.0 (/lib64/libwebsockets.so.19+0x5402f)
48:     #7 0x7f4a5fd98151 in lws_service_fd_tsi (/lib64/libwebsockets.so.19+0x43151)
48:     #8 0x7f4a5fd751b1 in _lws_plat_service_forced_tsi (/lib64/libwebsockets.so.19+0x201b1)
48:     #9 0x7f4a5fd7acc8 in _lws_plat_service_tsi (/lib64/libwebsockets.so.19+0x25cc8)
48:     #10 0x7f4a5fd97ac6 in lws_service (/lib64/libwebsockets.so.19+0x42ac6)
48:     #11 0x56ee44 in http_thread_run /home/jdanek/repos/skupper-router/src/http-libwebsockets.c:935
48:     #12 0x7f4a5f1c5e1c in start_thread (/lib64/libc.so.6+0x8ce1c)
48:     #13 0x7f4a5f24b5df in __GI___clone3 (/lib64/libc.so.6+0x1125df)
48: 
48: SUMMARY: AddressSanitizer: 1152 byte(s) leaked in 6 allocation(s).
@jiridanek
Copy link
Contributor Author

jiridanek commented Jun 10, 2022

First obvious mistake is that the handlers handle LWS_CALLBACK_CLOSED event, but since they actually handle HTTP connections and not websocket connections, this is event they never get, instead they get LWS_CALLBACK_CLOSED_HTTP.

jiridanek added a commit to jiridanek/skupper-router that referenced this issue Jun 10, 2022
…r; the websocket close event is never delivered here
@jiridanek
Copy link
Contributor Author

@jiridanek jiridanek self-assigned this Jun 10, 2022
@jiridanek jiridanek added this to the 2.1.0 milestone Jun 10, 2022
jiridanek added a commit to jiridanek/skupper-router that referenced this issue Jun 10, 2022
…r; the websocket close event is never delivered here
jiridanek added a commit that referenced this issue Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant