Valgrind Output of Failed Port Binding reveals lost blocks
Added by Christian Meyer 8 months ago
Hi there,
I am trying to figure out some weird stuff:
Some of my Modules mess with my Application and throw on Session Timeout (free() invalid Pointer, or double free())
Debugging the stack trace places the exception somewhere in the destructor for Widget, expecially the deletion of EventBaseSignal vector.
Running Valgrind by accident while another debugging session was active on the same Ports gave this output
Valgrind Complete LogValgrind Complete Log
Executing task in folder wt-project: valgrind --vgdb=full /home/project-build/Debug/source/WtApplication.wt --docroot="/home/wt-project/docroot;/favicon.ico,/resources,/Apps,/Modules" --approot /home/wt-project/approot --resources-dir /home/resources --http-listen [0::0]:8080 --config /home/wt_config.xml
==29806== Memcheck, a memory error detector
==29806== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==29806== Using Valgrind-3.18.1 and LibVEX; rerun with -h for copyright info
==29806== Command: /home/project-build/Debug/source/WtApplication.wt --docroot=/home/wt-project/docroot;/favicon.ico,/resources,/Apps,/Modules --approot /home/wt-project/approot --resources-dir /home/resources --http-listen [0::0]:8080 --config /home/wt_config.xml
==29806==
[2024-Feb-22 16:26:57.306] 29806 - [info] "config: reading Wt config file: /home/wt_config.xml (location = '/home/project-build/Debug/source/WtApplication.wt')"
[2024-Feb-22 16:26:57.646] 29806 - [info] "WServer/wthttp: initializing built-in wthttpd"
[2024-Feb-22 16:26:58.025] 29806 - [warning] "wthttp: Error occurred when binding to :::8080
Address already in use"
Error: Could not bind to address 0::0 port 8080: Could not listen on address.
==29806== Invalid read of size 8
==29806== at 0x6D32CB0: __tcf_5 (in /usr/local/lib/libwt.so.4.10.3)
==29806== by 0x5BB8A55: __cxa_finalize (cxa_finalize.c:83)
==29806== by 0x687AF06: ??? (in /usr/local/lib/libwt.so.4.10.3)
==29806== by 0x400624D: _dl_fini (dl-fini.c:142)
==29806== by 0x5BB8494: __run_exit_handlers (exit.c:113)
==29806== by 0x5BB860F: exit (exit.c:143)
==29806== by 0x5B9CD96: (below main) (libc_start_call_main.h:74)
==29806== Address 0xcb865f8 is 8 bytes inside a block of size 160 free'd
==29806== at 0x484BB6F: operator delete(void*, unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==29806== by 0x4C419E9: __gnu_cxx::new_allocator<Wt::EscapeOStream::Entry>::deallocate(Wt::EscapeOStream::Entry*, unsigned long) (new_allocator.h:145)
==29806== by 0x4C413B7: std::allocator_traits<std::allocator<Wt::EscapeOStream::Entry> >::deallocate(std::allocator<Wt::EscapeOStream::Entry>&, Wt::EscapeOStream::Entry*, unsigned long) (alloc_traits.h:496)
==29806== by 0x4C401D1: std::_Vector_base<Wt::EscapeOStream::Entry, std::allocator<Wt::EscapeOStream::Entry> >::_M_deallocate(Wt::EscapeOStream::Entry*, unsigned long) (stl_vector.h:354)
==29806== by 0x4C3EC68: std::_Vector_base<Wt::EscapeOStream::Entry, std::allocator<Wt::EscapeOStream::Entry> >::~_Vector_base() (stl_vector.h:335)
==29806== by 0x4C3D906: std::vector<Wt::EscapeOStream::Entry, std::allocator<Wt::EscapeOStream::Entry> >::~vector() (stl_vector.h:683)
==29806== by 0x524521C: __tcf_5 (EscapeOStream.C:54)
==29806== by 0x5BB8A55: __cxa_finalize (cxa_finalize.c:83)
==29806== by 0x4B290F6: ??? (in /usr/local/lib/libwtd.so.4.10.3)
==29806== by 0x400624D: _dl_fini (dl-fini.c:142)
==29806== by 0x5BB8494: __run_exit_handlers (exit.c:113)
==29806== by 0x5BB860F: exit (exit.c:143)
==29806== Block was alloc'd at
==29806== at 0x4849013: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==29806== by 0x5248ACB: __gnu_cxx::new_allocator<Wt::EscapeOStream::Entry>::allocate(unsigned long, void const*) (new_allocator.h:127)
==29806== by 0x5248346: std::allocator_traits<std::allocator<Wt::EscapeOStream::Entry> >::allocate(std::allocator<Wt::EscapeOStream::Entry>&, unsigned long) (alloc_traits.h:464)
==29806== by 0x5247793: std::_Vector_base<Wt::EscapeOStream::Entry, std::allocator<Wt::EscapeOStream::Entry> >::_M_allocate(unsigned long) (stl_vector.h:346)
==29806== by 0x5246C2A: void std::vector<Wt::EscapeOStream::Entry, std::allocator<Wt::EscapeOStream::Entry> >::_M_range_initialize<Wt::EscapeOStream::Entry const*>(Wt::EscapeOStream::Entry const*, Wt::EscapeOStream::Entry const*, std::forward_iterator_tag) (stl_vector.h:1582)
==29806== by 0x5246145: std::vector<Wt::EscapeOStream::Entry, std::allocator<Wt::EscapeOStream::Entry> >::vector<Wt::EscapeOStream::Entry const*, void>(Wt::EscapeOStream::Entry const*, Wt::EscapeOStream::Entry const*, std::allocator<Wt::EscapeOStream::Entry> const&) (stl_vector.h:657)
==29806== by 0x5245A41: __static_initialization_and_destruction_0(int, int) (EscapeOStream.C:66)
==29806== by 0x5246015: _GLOBAL__sub_I_EscapeOStream.C (EscapeOStream.C:271)
==29806== by 0x400647D: call_init.part.0 (dl-init.c:70)
==29806== by 0x4006567: call_init (dl-init.c:33)
==29806== by 0x4006567: _dl_init (dl-init.c:117)
==29806== by 0x40202C9: ??? (in /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
==29806== by 0x9: ???
==29806==
==29806== Invalid free() / delete / delete[] / realloc()
==29806== at 0x484BB6F: operator delete(void*, unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==29806== by 0x6D32CE8: __tcf_5 (in /usr/local/lib/libwt.so.4.10.3)
==29806== by 0x5BB8A55: __cxa_finalize (cxa_finalize.c:83)
==29806== by 0x687AF06: ??? (in /usr/local/lib/libwt.so.4.10.3)
==29806== by 0x400624D: _dl_fini (dl-fini.c:142)
==29806== by 0x5BB8494: __run_exit_handlers (exit.c:113)
==29806== by 0x5BB860F: exit (exit.c:143)
==29806== by 0x5B9CD96: (below main) (libc_start_call_main.h:74)
==29806== Address 0xcb865f0 is 0 bytes inside a block of size 160 free'd
==29806== at 0x484BB6F: operator delete(void*, unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==29806== by 0x4C419E9: __gnu_cxx::new_allocator<Wt::EscapeOStream::Entry>::deallocate(Wt::EscapeOStream::Entry*, unsigned long) (new_allocator.h:145)
==29806== by 0x4C413B7: std::allocator_traits<std::allocator<Wt::EscapeOStream::Entry> >::deallocate(std::allocator<Wt::EscapeOStream::Entry>&, Wt::EscapeOStream::Entry*, unsigned long) (alloc_traits.h:496)
==29806== by 0x4C401D1: std::_Vector_base<Wt::EscapeOStream::Entry, std::allocator<Wt::EscapeOStream::Entry> >::_M_deallocate(Wt::EscapeOStream::Entry*, unsigned long) (stl_vector.h:354)
==29806== by 0x4C3EC68: std::_Vector_base<Wt::EscapeOStream::Entry, std::allocator<Wt::EscapeOStream::Entry> >::~_Vector_base() (stl_vector.h:335)
==29806== by 0x4C3D906: std::vector<Wt::EscapeOStream::Entry, std::allocator<Wt::EscapeOStream::Entry> >::~vector() (stl_vector.h:683)
==29806== by 0x524521C: __tcf_5 (EscapeOStream.C:54)
==29806== by 0x5BB8A55: __cxa_finalize (cxa_finalize.c:83)
==29806== by 0x4B290F6: ??? (in /usr/local/lib/libwtd.so.4.10.3)
==29806== by 0x400624D: _dl_fini (dl-fini.c:142)
==29806== by 0x5BB8494: __run_exit_handlers (exit.c:113)
==29806== by 0x5BB860F: exit (exit.c:143)
==29806== Block was alloc'd at
==29806== at 0x4849013: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==29806== by 0x5248ACB: __gnu_cxx::new_allocator<Wt::EscapeOStream::Entry>::allocate(unsigned long, void const*) (new_allocator.h:127)
==29806== by 0x5248346: std::allocator_traits<std::allocator<Wt::EscapeOStream::Entry> >::allocate(std::allocator<Wt::EscapeOStream::Entry>&, unsigned long) (alloc_traits.h:464)
==29806== by 0x5247793: std::_Vector_base<Wt::EscapeOStream::Entry, std::allocator<Wt::EscapeOStream::Entry> >::_M_allocate(unsigned long) (stl_vector.h:346)
==29806== by 0x5246C2A: void std::vector<Wt::EscapeOStream::Entry, std::allocator<Wt::EscapeOStream::Entry> >::_M_range_initialize<Wt::EscapeOStream::Entry const*>(Wt::EscapeOStream::Entry const*, Wt::EscapeOStream::Entry const*, std::forward_iterator_tag) (stl_vector.h:1582)
==29806== by 0x5246145: std::vector<Wt::EscapeOStream::Entry, std::allocator<Wt::EscapeOStream::Entry> >::vector<Wt::EscapeOStream::Entry const*, void>(Wt::EscapeOStream::Entry const*, Wt::EscapeOStream::Entry const*, std::allocator<Wt::EscapeOStream::Entry> const&) (stl_vector.h:657)
==29806== by 0x5245A41: __static_initialization_and_destruction_0(int, int) (EscapeOStream.C:66)
==29806== by 0x5246015: _GLOBAL__sub_I_EscapeOStream.C (EscapeOStream.C:271)
==29806== by 0x400647D: call_init.part.0 (dl-init.c:70)
==29806== by 0x4006567: call_init (dl-init.c:33)
==29806== by 0x4006567: _dl_init (dl-init.c:117)
==29806== by 0x40202C9: ??? (in /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
==29806== by 0x9: ???
==29806==
==29806== Invalid free() / delete / delete[] / realloc()
==29806== at 0x484B8AF: operator delete(void*) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==29806== by 0x5BB8A55: __cxa_finalize (cxa_finalize.c:83)
==29806== by 0x687AF06: ??? (in /usr/local/lib/libwt.so.4.10.3)
==29806== by 0x400624D: _dl_fini (dl-fini.c:142)
==29806== by 0x5BB8494: __run_exit_handlers (exit.c:113)
==29806== by 0x5BB860F: exit (exit.c:143)
==29806== by 0x5B9CD96: (below main) (libc_start_call_main.h:74)
==29806== Address 0xcafe610 is 0 bytes inside a block of size 46 free'd
==29806== at 0x484B8AF: operator delete(void*) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==29806== by 0x5BB8A55: __cxa_finalize (cxa_finalize.c:83)
==29806== by 0x4B290F6: ??? (in /usr/local/lib/libwtd.so.4.10.3)
==29806== by 0x400624D: _dl_fini (dl-fini.c:142)
==29806== by 0x5BB8494: __run_exit_handlers (exit.c:113)
==29806== by 0x5BB860F: exit (exit.c:143)
==29806== by 0x5B9CD96: (below main) (libc_start_call_main.h:74)
==29806== Block was alloc'd at
==29806== at 0x4849013: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==29806== by 0x111111: void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*, std::forward_iterator_tag) (basic_string.tcc:219)
==29806== by 0x4B2D4AC: std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string<std::allocator<char> >(char const*, std::allocator<char> const&) (basic_string.h:539)
==29806== by 0x4D64333: __static_initialization_and_destruction_0(int, int) (WLeafletMap.C:38)
==29806== by 0x4D643D1: _GLOBAL__sub_I_WLeafletMap.C (WLeafletMap.C:802)
==29806== by 0x400647D: call_init.part.0 (dl-init.c:70)
==29806== by 0x4006567: call_init (dl-init.c:33)
==29806== by 0x4006567: _dl_init (dl-init.c:117)
==29806== by 0x40202C9: ??? (in /usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2)
==29806== by 0x9: ???
==29806== by 0x1FFF000856: ???
==29806== by 0x1FFF000888: ???
==29806== by 0x1FFF0008D2: ???
==29806==
==29806==
==29806== HEAP SUMMARY:
==29806== in use at exit: 53,834 bytes in 271 blocks
==29806== total heap usage: 24,296 allocs, 24,033 frees, 2,185,561 bytes allocated
==29806==
==29806== LEAK SUMMARY:
==29806== definitely lost: 3,190 bytes in 8 blocks
==29806== indirectly lost: 0 bytes in 0 blocks
==29806== possibly lost: 0 bytes in 0 blocks
==29806== still reachable: 48,628 bytes in 242 blocks
==29806== suppressed: 0 bytes in 0 blocks
==29806== Rerun with --leak-check=full to see details of leaked memory
==29806==
==29806== For lists of detected and suppressed errors, rerun with: -s
==29806== ERROR SUMMARY: 28 errors from 3 contexts (suppressed: 0 from 0)
* The terminal process "/usr/bin/bash '-c', 'valgrind --vgdb=full /home/project-build/Debug/source/WtApplication.wt --docroot="/home/wt-project/docroot;/favicon.ico,/resources,/Apps,/Modules" --approot /home/wt-project/approot --resources-dir /home/resources --http-listen [0::0]:8080 --config /home/wt_config.xml'" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
With this Summary:
==29806== HEAP SUMMARY:
==29806== in use at exit: 53,834 bytes in 271 blocks
==29806== total heap usage: 24,296 allocs, 24,033 frees, 2,185,561 bytes allocated
==29806==
==29806== LEAK SUMMARY:
==29806== definitely lost: 3,190 bytes in 8 blocks
==29806== indirectly lost: 0 bytes in 0 blocks
==29806== possibly lost: 0 bytes in 0 blocks
==29806== still reachable: 48,628 bytes in 242 blocks
==29806== suppressed: 0 bytes in 0 blocks
==29806== Rerun with --leak-check=full to see details of leaked memory
==29806==
==29806== For lists of detected and suppressed errors, rerun with: -s
==29806== ERROR SUMMARY: 28 errors from 3 contexts (suppressed: 0 from 0)
I don't think that is supposed to happen?
I have no experience with valgrind so I can only guess how output like that is helping, but it messes with my problem search =/
Cheers,
Christian
Replies (1)
RE: Valgrind Output of Failed Port Binding reveals lost blocks - Added by Matthias Van Ceulebroeck 3 months ago
Hello Christian,
I'm sorry for the late reply, I'm getting up to speed on missed entries here, since I've been busy.
It's hard to reproduce this without some more context. Is there the possibility to provide me with a minimal example that exhibits this behavior, so that I can verify the issue?
Best regards,
Matthias