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

Translate '/loleaflet/po/templates/loleaflet-help.pot' in 'de' #14

Conversation

transifex-integration[bot]
Copy link
Contributor

The translations for the following file are now complete:

Parameter Value
Source file '/loleaflet/po/templates/loleaflet-help.pot'
Translation file 'loleaflet/po/help-de.po'
Language code 'de'
Transifex project slug collabora-online-help
Transifex resource slug loleaflet-po-templates-loleaflet-help-pot--master
Transifex event translation_completed

translation completed for the source file '/loleaflet/po/templates/loleaflet-help.pot'
on the 'de' language.
@timar
Copy link
Member

timar commented Oct 1, 2020

No value, translation is already 100% in repo.

@timar timar closed this Oct 1, 2020
@timar timar deleted the translations_loleaflet-po-templates-loleaflet-help-pot--master_de branch October 1, 2020 12:11
Ashod added a commit that referenced this pull request Mar 13, 2021
The lifetime management of static objects
is extremely unpredictable and depends on
many variables outside of our control or
even reliable reproducibility.

Complex static objects that own threads
and other objects are doubly problematic
because of their dependency and/or
interaction with other objects.

Here we replace the static DelayPoll
instance with one we control its lifetime
in the LOOLWSD main body, such that it
is destroyed properly.

Specifically, DelayPoll's dtor  was
accessing Poco's Logging subsystem out of
order. That is, after Poco had been
destroyed.

Another advantage to this approach is that
we don't even create the DelayPoll at all
if we don't need it. The onus now is on
the user of DelayPoll to make sure they
create a Delay object with a long-enough
lifetime to encompase it use.

For completeness, here is the stacktrace:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b5927 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555982a14 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585a909 in SocketPoll::~SocketPoll (this=0x555555d10f60 <DelayPoll>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #14 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #15 0x0000555555752d78 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #16 0x0000555555788b07 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:432
    #17 0x00005555558dd7e4 in Poco::Util::Application::run() ()
    #18 0x00005555556b6574 in main (argc=2, argv=0x7fffffffe528) at wsd/LOOLWSD.cpp:4276

Change-Id: Ifda55fe869fa6734b9c2490da4497d2551ac21c1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Ashod added a commit that referenced this pull request Mar 13, 2021
The lifetime management of static objects
is extremely unpredictable and depends on
many variables outside of our control or
even reliable reproducibility.

Complex static objects that own threads
and other objects are doubly problematic
because of their dependency and/or
interaction with other objects.

Here we replace the static DelayPoll
instance with one we control its lifetime
in the LOOLWSD main body, such that it
is destroyed properly.

Specifically, DelayPoll's dtor  was
accessing Poco's Logging subsystem out of
order. That is, after Poco had been
destroyed.

Another advantage to this approach is that
we don't even create the DelayPoll at all
if we don't need it. The onus now is on
the user of DelayPoll to make sure they
create a Delay object with a long-enough
lifetime to encompase it use.

For completeness, here is the stacktrace:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b5927 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555982a14 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585a909 in SocketPoll::~SocketPoll (this=0x555555d10f60 <DelayPoll>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #14 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #15 0x0000555555752d78 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #16 0x0000555555788b07 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:432
    #17 0x00005555558dd7e4 in Poco::Util::Application::run() ()
    #18 0x00005555556b6574 in main (argc=2, argv=0x7fffffffe528) at wsd/LOOLWSD.cpp:4276

Change-Id: Ifda55fe869fa6734b9c2490da4497d2551ac21c1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Ashod added a commit that referenced this pull request Mar 13, 2021
The lifetime management of static objects
is extremely unpredictable and depends on
many variables outside of our control or
even reliable reproducibility.

Complex static objects that own threads
and other objects are doubly problematic
because of their dependency and/or
interaction with other objects.

Here we replace the static DelayPoll
instance with one we control its lifetime
in the LOOLWSD main body, such that it
is destroyed properly.

Specifically, DelayPoll's dtor  was
accessing Poco's Logging subsystem out of
order. That is, after Poco had been
destroyed.

Another advantage to this approach is that
we don't even create the DelayPoll at all
if we don't need it. The onus now is on
the user of DelayPoll to make sure they
create a Delay object with a long-enough
lifetime to encompase it use.

For completeness, here is the stacktrace:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b5927 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555982a14 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585a909 in SocketPoll::~SocketPoll (this=0x555555d10f60 <DelayPoll>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #14 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #15 0x0000555555752d78 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #16 0x0000555555788b07 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:432
    #17 0x00005555558dd7e4 in Poco::Util::Application::run() ()
    #18 0x00005555556b6574 in main (argc=2, argv=0x7fffffffe528) at wsd/LOOLWSD.cpp:4276

Change-Id: Ifda55fe869fa6734b9c2490da4497d2551ac21c1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Ashod added a commit that referenced this pull request Mar 13, 2021
The lifetime management of static objects
is extremely unpredictable and depends on
many variables outside of our control or
even reliable reproducibility.

Complex static objects that own threads
and other objects are doubly problematic
because of their dependency and/or
interaction with other objects.

Here we replace the static DelayPoll
instance with one we control its lifetime
in the LOOLWSD main body, such that it
is destroyed properly.

Specifically, DelayPoll's dtor  was
accessing Poco's Logging subsystem out of
order. That is, after Poco had been
destroyed.

Another advantage to this approach is that
we don't even create the DelayPoll at all
if we don't need it. The onus now is on
the user of DelayPoll to make sure they
create a Delay object with a long-enough
lifetime to encompase it use.

For completeness, here is the stacktrace:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b5927 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555982a14 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585a909 in SocketPoll::~SocketPoll (this=0x555555d10f60 <DelayPoll>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #14 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #15 0x0000555555752d78 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #16 0x0000555555788b07 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:432
    #17 0x00005555558dd7e4 in Poco::Util::Application::run() ()
    #18 0x00005555556b6574 in main (argc=2, argv=0x7fffffffe528) at wsd/LOOLWSD.cpp:4276

Change-Id: Ifda55fe869fa6734b9c2490da4497d2551ac21c1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Ashod added a commit that referenced this pull request Mar 13, 2021
LOOLWSDServer needs to shutdown its
accept_poll SocketPoll in its destructor,
which may be called after Poco's Logging
subsystem has been destroyed.

Instead of managing the lifetime of
accept_poll member of LOOLWSDServer,
it is safer to manage the lifetime
of LOOLWSDServer itself, and destroy
it in the cleanup stage. This makes
sure that its other members, or indeed
LOOLWSDServer itself, can't have any
late-destoryed objects that can cause
trouble.

The stacktrace for this crash:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b6127 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555986b94 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585ea49 in SocketPoll::~SocketPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x000055555575d794 in TerminatingPoll::~TerminatingPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at ./net/Socket.hpp:832
    #14 LOOLWSDServer::AcceptPoll::~AcceptPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3766
    #15 LOOLWSDServer::~LOOLWSDServer (this=0x555555d13480 <srv>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3640
    #16 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #17 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #18 0x0000555555753658 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #19 0x0000555555789527 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:439
    #20 0x00005555558e1964 in Poco::Util::Application::run() ()
    #21 0x00005555556b6d74 in main (argc=3, argv=0x7fffffffe4f8) at wsd/LOOLWSD.cpp:4286

Change-Id: I28ea6215ce49c752cbb90bc33269ab3b662accf1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Ashod added a commit that referenced this pull request Mar 13, 2021
The lifetime management of static objects
is extremely unpredictable and depends on
many variables outside of our control or
even reliable reproducibility.

Complex static objects that own threads
and other objects are doubly problematic
because of their dependency and/or
interaction with other objects.

Here we replace the static DelayPoll
instance with one we control its lifetime
in the LOOLWSD main body, such that it
is destroyed properly.

Specifically, DelayPoll's dtor  was
accessing Poco's Logging subsystem out of
order. That is, after Poco had been
destroyed.

Another advantage to this approach is that
we don't even create the DelayPoll at all
if we don't need it. The onus now is on
the user of DelayPoll to make sure they
create a Delay object with a long-enough
lifetime to encompase it use.

For completeness, here is the stacktrace:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b5927 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555982a14 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585a909 in SocketPoll::~SocketPoll (this=0x555555d10f60 <DelayPoll>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #14 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #15 0x0000555555752d78 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #16 0x0000555555788b07 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:432
    #17 0x00005555558dd7e4 in Poco::Util::Application::run() ()
    #18 0x00005555556b6574 in main (argc=2, argv=0x7fffffffe528) at wsd/LOOLWSD.cpp:4276

Change-Id: Ifda55fe869fa6734b9c2490da4497d2551ac21c1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Ashod added a commit that referenced this pull request Mar 13, 2021
LOOLWSDServer needs to shutdown its
accept_poll SocketPoll in its destructor,
which may be called after Poco's Logging
subsystem has been destroyed.

Instead of managing the lifetime of
accept_poll member of LOOLWSDServer,
it is safer to manage the lifetime
of LOOLWSDServer itself, and destroy
it in the cleanup stage. This makes
sure that its other members, or indeed
LOOLWSDServer itself, can't have any
late-destoryed objects that can cause
trouble.

The stacktrace for this crash:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b6127 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555986b94 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585ea49 in SocketPoll::~SocketPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x000055555575d794 in TerminatingPoll::~TerminatingPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at ./net/Socket.hpp:832
    #14 LOOLWSDServer::AcceptPoll::~AcceptPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3766
    #15 LOOLWSDServer::~LOOLWSDServer (this=0x555555d13480 <srv>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3640
    #16 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #17 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #18 0x0000555555753658 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #19 0x0000555555789527 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:439
    #20 0x00005555558e1964 in Poco::Util::Application::run() ()
    #21 0x00005555556b6d74 in main (argc=3, argv=0x7fffffffe4f8) at wsd/LOOLWSD.cpp:4286

Change-Id: I28ea6215ce49c752cbb90bc33269ab3b662accf1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Ashod added a commit that referenced this pull request Mar 13, 2021
The lifetime management of static objects
is extremely unpredictable and depends on
many variables outside of our control or
even reliable reproducibility.

Complex static objects that own threads
and other objects are doubly problematic
because of their dependency and/or
interaction with other objects.

Here we replace the static DelayPoll
instance with one we control its lifetime
in the LOOLWSD main body, such that it
is destroyed properly.

Specifically, DelayPoll's dtor  was
accessing Poco's Logging subsystem out of
order. That is, after Poco had been
destroyed.

Another advantage to this approach is that
we don't even create the DelayPoll at all
if we don't need it. The onus now is on
the user of DelayPoll to make sure they
create a Delay object with a long-enough
lifetime to encompase it use.

For completeness, here is the stacktrace:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b5927 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555982a14 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585a909 in SocketPoll::~SocketPoll (this=0x555555d10f60 <DelayPoll>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #14 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #15 0x0000555555752d78 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #16 0x0000555555788b07 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:432
    #17 0x00005555558dd7e4 in Poco::Util::Application::run() ()
    #18 0x00005555556b6574 in main (argc=2, argv=0x7fffffffe528) at wsd/LOOLWSD.cpp:4276

Change-Id: Ifda55fe869fa6734b9c2490da4497d2551ac21c1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Ashod added a commit that referenced this pull request Mar 13, 2021
LOOLWSDServer needs to shutdown its
accept_poll SocketPoll in its destructor,
which may be called after Poco's Logging
subsystem has been destroyed.

Instead of managing the lifetime of
accept_poll member of LOOLWSDServer,
it is safer to manage the lifetime
of LOOLWSDServer itself, and destroy
it in the cleanup stage. This makes
sure that its other members, or indeed
LOOLWSDServer itself, can't have any
late-destoryed objects that can cause
trouble.

The stacktrace for this crash:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b6127 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555986b94 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585ea49 in SocketPoll::~SocketPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x000055555575d794 in TerminatingPoll::~TerminatingPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at ./net/Socket.hpp:832
    #14 LOOLWSDServer::AcceptPoll::~AcceptPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3766
    #15 LOOLWSDServer::~LOOLWSDServer (this=0x555555d13480 <srv>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3640
    #16 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #17 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #18 0x0000555555753658 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #19 0x0000555555789527 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:439
    #20 0x00005555558e1964 in Poco::Util::Application::run() ()
    #21 0x00005555556b6d74 in main (argc=3, argv=0x7fffffffe4f8) at wsd/LOOLWSD.cpp:4286

Change-Id: I28ea6215ce49c752cbb90bc33269ab3b662accf1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Ashod added a commit that referenced this pull request Mar 13, 2021
The lifetime management of static objects
is extremely unpredictable and depends on
many variables outside of our control or
even reliable reproducibility.

Complex static objects that own threads
and other objects are doubly problematic
because of their dependency and/or
interaction with other objects.

Here we replace the static DelayPoll
instance with one we control its lifetime
in the LOOLWSD main body, such that it
is destroyed properly.

Specifically, DelayPoll's dtor  was
accessing Poco's Logging subsystem out of
order. That is, after Poco had been
destroyed.

Another advantage to this approach is that
we don't even create the DelayPoll at all
if we don't need it. The onus now is on
the user of DelayPoll to make sure they
create a Delay object with a long-enough
lifetime to encompase it use.

For completeness, here is the stacktrace:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b5927 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555982a14 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585a909 in SocketPoll::~SocketPoll (this=0x555555d10f60 <DelayPoll>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #14 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #15 0x0000555555752d78 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #16 0x0000555555788b07 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:432
    #17 0x00005555558dd7e4 in Poco::Util::Application::run() ()
    #18 0x00005555556b6574 in main (argc=2, argv=0x7fffffffe528) at wsd/LOOLWSD.cpp:4276

Change-Id: Ifda55fe869fa6734b9c2490da4497d2551ac21c1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Ashod added a commit that referenced this pull request Mar 13, 2021
LOOLWSDServer needs to shutdown its
accept_poll SocketPoll in its destructor,
which may be called after Poco's Logging
subsystem has been destroyed.

Instead of managing the lifetime of
accept_poll member of LOOLWSDServer,
it is safer to manage the lifetime
of LOOLWSDServer itself, and destroy
it in the cleanup stage. This makes
sure that its other members, or indeed
LOOLWSDServer itself, can't have any
late-destoryed objects that can cause
trouble.

The stacktrace for this crash:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b6127 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555986b94 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585ea49 in SocketPoll::~SocketPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x000055555575d794 in TerminatingPoll::~TerminatingPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at ./net/Socket.hpp:832
    #14 LOOLWSDServer::AcceptPoll::~AcceptPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3766
    #15 LOOLWSDServer::~LOOLWSDServer (this=0x555555d13480 <srv>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3640
    #16 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #17 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #18 0x0000555555753658 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #19 0x0000555555789527 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:439
    #20 0x00005555558e1964 in Poco::Util::Application::run() ()
    #21 0x00005555556b6d74 in main (argc=3, argv=0x7fffffffe4f8) at wsd/LOOLWSD.cpp:4286

Change-Id: I28ea6215ce49c752cbb90bc33269ab3b662accf1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Ashod added a commit that referenced this pull request Mar 13, 2021
The lifetime management of static objects
is extremely unpredictable and depends on
many variables outside of our control or
even reliable reproducibility.

Complex static objects that own threads
and other objects are doubly problematic
because of their dependency and/or
interaction with other objects.

Here we replace the static DelayPoll
instance with one we control its lifetime
in the LOOLWSD main body, such that it
is destroyed properly.

Specifically, DelayPoll's dtor  was
accessing Poco's Logging subsystem out of
order. That is, after Poco had been
destroyed.

Another advantage to this approach is that
we don't even create the DelayPoll at all
if we don't need it. The onus now is on
the user of DelayPoll to make sure they
create a Delay object with a long-enough
lifetime to encompase it use.

For completeness, here is the stacktrace:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b5927 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555982a14 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585a909 in SocketPoll::~SocketPoll (this=0x555555d10f60 <DelayPoll>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #14 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #15 0x0000555555752d78 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #16 0x0000555555788b07 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:432
    #17 0x00005555558dd7e4 in Poco::Util::Application::run() ()
    #18 0x00005555556b6574 in main (argc=2, argv=0x7fffffffe528) at wsd/LOOLWSD.cpp:4276

Change-Id: Ifda55fe869fa6734b9c2490da4497d2551ac21c1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Ashod added a commit that referenced this pull request Mar 13, 2021
LOOLWSDServer needs to shutdown its
accept_poll SocketPoll in its destructor,
which may be called after Poco's Logging
subsystem has been destroyed.

Instead of managing the lifetime of
accept_poll member of LOOLWSDServer,
it is safer to manage the lifetime
of LOOLWSDServer itself, and destroy
it in the cleanup stage. This makes
sure that its other members, or indeed
LOOLWSDServer itself, can't have any
late-destoryed objects that can cause
trouble.

The stacktrace for this crash:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b6127 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555986b94 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585ea49 in SocketPoll::~SocketPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x000055555575d794 in TerminatingPoll::~TerminatingPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at ./net/Socket.hpp:832
    #14 LOOLWSDServer::AcceptPoll::~AcceptPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3766
    #15 LOOLWSDServer::~LOOLWSDServer (this=0x555555d13480 <srv>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3640
    #16 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #17 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #18 0x0000555555753658 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #19 0x0000555555789527 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:439
    #20 0x00005555558e1964 in Poco::Util::Application::run() ()
    #21 0x00005555556b6d74 in main (argc=3, argv=0x7fffffffe4f8) at wsd/LOOLWSD.cpp:4286

Change-Id: I28ea6215ce49c752cbb90bc33269ab3b662accf1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
gmasei11 pushed a commit that referenced this pull request Mar 15, 2021
The lifetime management of static objects
is extremely unpredictable and depends on
many variables outside of our control or
even reliable reproducibility.

Complex static objects that own threads
and other objects are doubly problematic
because of their dependency and/or
interaction with other objects.

Here we replace the static DelayPoll
instance with one we control its lifetime
in the LOOLWSD main body, such that it
is destroyed properly.

Specifically, DelayPoll's dtor  was
accessing Poco's Logging subsystem out of
order. That is, after Poco had been
destroyed.

Another advantage to this approach is that
we don't even create the DelayPoll at all
if we don't need it. The onus now is on
the user of DelayPoll to make sure they
create a Delay object with a long-enough
lifetime to encompase it use.

For completeness, here is the stacktrace:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b5927 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555982a14 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585a909 in SocketPoll::~SocketPoll (this=0x555555d10f60 <DelayPoll>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #14 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #15 0x0000555555752d78 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #16 0x0000555555788b07 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:432
    #17 0x00005555558dd7e4 in Poco::Util::Application::run() ()
    #18 0x00005555556b6574 in main (argc=2, argv=0x7fffffffe528) at wsd/LOOLWSD.cpp:4276

Change-Id: Ifda55fe869fa6734b9c2490da4497d2551ac21c1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
gmasei11 pushed a commit that referenced this pull request Mar 15, 2021
LOOLWSDServer needs to shutdown its
accept_poll SocketPoll in its destructor,
which may be called after Poco's Logging
subsystem has been destroyed.

Instead of managing the lifetime of
accept_poll member of LOOLWSDServer,
it is safer to manage the lifetime
of LOOLWSDServer itself, and destroy
it in the cleanup stage. This makes
sure that its other members, or indeed
LOOLWSDServer itself, can't have any
late-destoryed objects that can cause
trouble.

The stacktrace for this crash:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b6127 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555986b94 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585ea49 in SocketPoll::~SocketPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x000055555575d794 in TerminatingPoll::~TerminatingPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at ./net/Socket.hpp:832
    #14 LOOLWSDServer::AcceptPoll::~AcceptPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3766
    #15 LOOLWSDServer::~LOOLWSDServer (this=0x555555d13480 <srv>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3640
    #16 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #17 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #18 0x0000555555753658 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #19 0x0000555555789527 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:439
    #20 0x00005555558e1964 in Poco::Util::Application::run() ()
    #21 0x00005555556b6d74 in main (argc=3, argv=0x7fffffffe4f8) at wsd/LOOLWSD.cpp:4286

Change-Id: I28ea6215ce49c752cbb90bc33269ab3b662accf1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Ashod added a commit that referenced this pull request Apr 18, 2021
The lifetime management of static objects
is extremely unpredictable and depends on
many variables outside of our control or
even reliable reproducibility.

Complex static objects that own threads
and other objects are doubly problematic
because of their dependency and/or
interaction with other objects.

Here we replace the static DelayPoll
instance with one we control its lifetime
in the LOOLWSD main body, such that it
is destroyed properly.

Specifically, DelayPoll's dtor  was
accessing Poco's Logging subsystem out of
order. That is, after Poco had been
destroyed.

Another advantage to this approach is that
we don't even create the DelayPoll at all
if we don't need it. The onus now is on
the user of DelayPoll to make sure they
create a Delay object with a long-enough
lifetime to encompase it use.

For completeness, here is the stacktrace:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b5927 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555982a14 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585a909 in SocketPoll::~SocketPoll (this=0x555555d10f60 <DelayPoll>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #14 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #15 0x0000555555752d78 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #16 0x0000555555788b07 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:432
    #17 0x00005555558dd7e4 in Poco::Util::Application::run() ()
    #18 0x00005555556b6574 in main (argc=2, argv=0x7fffffffe528) at wsd/LOOLWSD.cpp:4276

Change-Id: Ifda55fe869fa6734b9c2490da4497d2551ac21c1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 42a7607)
Ashod added a commit that referenced this pull request Apr 18, 2021
LOOLWSDServer needs to shutdown its
accept_poll SocketPoll in its destructor,
which may be called after Poco's Logging
subsystem has been destroyed.

Instead of managing the lifetime of
accept_poll member of LOOLWSDServer,
it is safer to manage the lifetime
of LOOLWSDServer itself, and destroy
it in the cleanup stage. This makes
sure that its other members, or indeed
LOOLWSDServer itself, can't have any
late-destoryed objects that can cause
trouble.

The stacktrace for this crash:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b6127 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555986b94 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585ea49 in SocketPoll::~SocketPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x000055555575d794 in TerminatingPoll::~TerminatingPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at ./net/Socket.hpp:832
    #14 LOOLWSDServer::AcceptPoll::~AcceptPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3766
    #15 LOOLWSDServer::~LOOLWSDServer (this=0x555555d13480 <srv>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3640
    #16 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #17 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #18 0x0000555555753658 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #19 0x0000555555789527 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:439
    #20 0x00005555558e1964 in Poco::Util::Application::run() ()
    #21 0x00005555556b6d74 in main (argc=3, argv=0x7fffffffe4f8) at wsd/LOOLWSD.cpp:4286

Change-Id: I28ea6215ce49c752cbb90bc33269ab3b662accf1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 3e5be29)
Ashod added a commit that referenced this pull request Apr 18, 2021
The lifetime management of static objects
is extremely unpredictable and depends on
many variables outside of our control or
even reliable reproducibility.

Complex static objects that own threads
and other objects are doubly problematic
because of their dependency and/or
interaction with other objects.

Here we replace the static DelayPoll
instance with one we control its lifetime
in the LOOLWSD main body, such that it
is destroyed properly.

Specifically, DelayPoll's dtor  was
accessing Poco's Logging subsystem out of
order. That is, after Poco had been
destroyed.

Another advantage to this approach is that
we don't even create the DelayPoll at all
if we don't need it. The onus now is on
the user of DelayPoll to make sure they
create a Delay object with a long-enough
lifetime to encompase it use.

For completeness, here is the stacktrace:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b5927 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555982a14 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585a909 in SocketPoll::~SocketPoll (this=0x555555d10f60 <DelayPoll>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #14 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #15 0x0000555555752d78 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #16 0x0000555555788b07 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:432
    #17 0x00005555558dd7e4 in Poco::Util::Application::run() ()
    #18 0x00005555556b6574 in main (argc=2, argv=0x7fffffffe528) at wsd/LOOLWSD.cpp:4276

Change-Id: Ifda55fe869fa6734b9c2490da4497d2551ac21c1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 42a7607)
Ashod added a commit that referenced this pull request Apr 18, 2021
LOOLWSDServer needs to shutdown its
accept_poll SocketPoll in its destructor,
which may be called after Poco's Logging
subsystem has been destroyed.

Instead of managing the lifetime of
accept_poll member of LOOLWSDServer,
it is safer to manage the lifetime
of LOOLWSDServer itself, and destroy
it in the cleanup stage. This makes
sure that its other members, or indeed
LOOLWSDServer itself, can't have any
late-destoryed objects that can cause
trouble.

The stacktrace for this crash:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b6127 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555986b94 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585ea49 in SocketPoll::~SocketPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x000055555575d794 in TerminatingPoll::~TerminatingPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at ./net/Socket.hpp:832
    #14 LOOLWSDServer::AcceptPoll::~AcceptPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3766
    #15 LOOLWSDServer::~LOOLWSDServer (this=0x555555d13480 <srv>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3640
    #16 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #17 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #18 0x0000555555753658 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #19 0x0000555555789527 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:439
    #20 0x00005555558e1964 in Poco::Util::Application::run() ()
    #21 0x00005555556b6d74 in main (argc=3, argv=0x7fffffffe4f8) at wsd/LOOLWSD.cpp:4286

Change-Id: I28ea6215ce49c752cbb90bc33269ab3b662accf1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 3e5be29)
Ashod added a commit that referenced this pull request Apr 19, 2021
The lifetime management of static objects
is extremely unpredictable and depends on
many variables outside of our control or
even reliable reproducibility.

Complex static objects that own threads
and other objects are doubly problematic
because of their dependency and/or
interaction with other objects.

Here we replace the static DelayPoll
instance with one we control its lifetime
in the LOOLWSD main body, such that it
is destroyed properly.

Specifically, DelayPoll's dtor  was
accessing Poco's Logging subsystem out of
order. That is, after Poco had been
destroyed.

Another advantage to this approach is that
we don't even create the DelayPoll at all
if we don't need it. The onus now is on
the user of DelayPoll to make sure they
create a Delay object with a long-enough
lifetime to encompase it use.

For completeness, here is the stacktrace:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b5927 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555982a14 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585a909 in SocketPoll::~SocketPoll (this=0x555555d10f60 <DelayPoll>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #14 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #15 0x0000555555752d78 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #16 0x0000555555788b07 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:432
    #17 0x00005555558dd7e4 in Poco::Util::Application::run() ()
    #18 0x00005555556b6574 in main (argc=2, argv=0x7fffffffe528) at wsd/LOOLWSD.cpp:4276

Change-Id: Ifda55fe869fa6734b9c2490da4497d2551ac21c1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 42a7607)
Ashod added a commit that referenced this pull request Apr 19, 2021
LOOLWSDServer needs to shutdown its
accept_poll SocketPoll in its destructor,
which may be called after Poco's Logging
subsystem has been destroyed.

Instead of managing the lifetime of
accept_poll member of LOOLWSDServer,
it is safer to manage the lifetime
of LOOLWSDServer itself, and destroy
it in the cleanup stage. This makes
sure that its other members, or indeed
LOOLWSDServer itself, can't have any
late-destoryed objects that can cause
trouble.

The stacktrace for this crash:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b6127 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555986b94 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585ea49 in SocketPoll::~SocketPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x000055555575d794 in TerminatingPoll::~TerminatingPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at ./net/Socket.hpp:832
    #14 LOOLWSDServer::AcceptPoll::~AcceptPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3766
    #15 LOOLWSDServer::~LOOLWSDServer (this=0x555555d13480 <srv>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3640
    #16 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #17 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #18 0x0000555555753658 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #19 0x0000555555789527 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:439
    #20 0x00005555558e1964 in Poco::Util::Application::run() ()
    #21 0x00005555556b6d74 in main (argc=3, argv=0x7fffffffe4f8) at wsd/LOOLWSD.cpp:4286

Change-Id: I28ea6215ce49c752cbb90bc33269ab3b662accf1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 3e5be29)
Ashod added a commit that referenced this pull request Apr 21, 2021
The lifetime management of static objects
is extremely unpredictable and depends on
many variables outside of our control or
even reliable reproducibility.

Complex static objects that own threads
and other objects are doubly problematic
because of their dependency and/or
interaction with other objects.

Here we replace the static DelayPoll
instance with one we control its lifetime
in the LOOLWSD main body, such that it
is destroyed properly.

Specifically, DelayPoll's dtor  was
accessing Poco's Logging subsystem out of
order. That is, after Poco had been
destroyed.

Another advantage to this approach is that
we don't even create the DelayPoll at all
if we don't need it. The onus now is on
the user of DelayPoll to make sure they
create a Delay object with a long-enough
lifetime to encompase it use.

For completeness, here is the stacktrace:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b5927 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555982a14 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585a909 in SocketPoll::~SocketPoll (this=0x555555d10f60 <DelayPoll>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #14 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #15 0x0000555555752d78 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #16 0x0000555555788b07 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:432
    #17 0x00005555558dd7e4 in Poco::Util::Application::run() ()
    #18 0x00005555556b6574 in main (argc=2, argv=0x7fffffffe528) at wsd/LOOLWSD.cpp:4276

Change-Id: Ifda55fe869fa6734b9c2490da4497d2551ac21c1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 42a7607)
Ashod added a commit that referenced this pull request Apr 21, 2021
LOOLWSDServer needs to shutdown its
accept_poll SocketPoll in its destructor,
which may be called after Poco's Logging
subsystem has been destroyed.

Instead of managing the lifetime of
accept_poll member of LOOLWSDServer,
it is safer to manage the lifetime
of LOOLWSDServer itself, and destroy
it in the cleanup stage. This makes
sure that its other members, or indeed
LOOLWSDServer itself, can't have any
late-destoryed objects that can cause
trouble.

The stacktrace for this crash:

    terminate called after throwing an instance of 'std::bad_alloc'
      what():  std::bad_alloc

    Program received signal SIGABRT, Aborted.
    __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    51      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
    (gdb) bt
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
    #1  0x00007ffff613f801 in __GI_abort () at abort.c:79
    #2  0x00007ffff6d51957 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #3  0x00007ffff6d57ae6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #4  0x00007ffff6d56b49 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #5  0x00007ffff6d574b8 in __gxx_personality_v0 () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #6  0x00007ffff671f573 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #7  0x00007ffff671fad1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
    #8  0x00007ffff6d57d47 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #9  0x00007ffff6d582dc in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    #10 0x00005555556b6127 in void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*>(char*, char*, std::forward_iterator_tag) [clone .isra.41] ()
    #11 0x0000555555986b94 in Poco::Message::Message(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Poco::Message::Priority) ()
    #12 0x000055555585ea49 in SocketPoll::~SocketPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at net/Socket.cpp:145
    #13 0x000055555575d794 in TerminatingPoll::~TerminatingPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at ./net/Socket.hpp:832
    #14 LOOLWSDServer::AcceptPoll::~AcceptPoll (this=0x555555d13490 <srv+16>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3766
    #15 LOOLWSDServer::~LOOLWSDServer (this=0x555555d13480 <srv>, __in_chrg=<optimized out>) at wsd/LOOLWSD.cpp:3640
    #16 0x00007ffff6142041 in __run_exit_handlers (status=0, listp=0x7ffff64ea718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
    #17 0x00007ffff614213a in __GI_exit (status=<optimized out>) at exit.c:139
    #18 0x0000555555753658 in LOOLWSD::innerInitialize (this=<optimized out>, self=...) at wsd/LOOLWSD.cpp:1213
    #19 0x0000555555789527 in LOOLWSD::initialize (this=<optimized out>, self=...) at wsd/LOOLWSD.hpp:439
    #20 0x00005555558e1964 in Poco::Util::Application::run() ()
    #21 0x00005555556b6d74 in main (argc=3, argv=0x7fffffffe4f8) at wsd/LOOLWSD.cpp:4286

Change-Id: I28ea6215ce49c752cbb90bc33269ab3b662accf1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 3e5be29)
Ashod added a commit that referenced this pull request Nov 29, 2022
Since UnitBase (and children) are invoked from
different threads, UnitBase::exitTest could
have a race. This ultimately results in
invoking std::thread::join() concurrently,
which is unsafe. This can result in the
following deadlock.

In this case websrv_poll had invoked
UnitBase::exitTest concurrently and
evidently finished, leaving the main
coolwsd thread deadlocked.

	(gdb) info thread
	  Id   Target Id                                     Frame
	* 1    Thread 0x7f67528f0840 (LWP 4058508) "coolwsd" __futex_abstimed_wait_common64 (private=128, cancel=true, abstime=0x0, op=265, expected=4058510, futex_word=0x7f675285c910)
		at ./nptl/futex-internal.c:57
	(gdb) t a a bt

	Thread 1 (Thread 0x7f67528f0840 (LWP 4058508) "coolwsd"):
	#0  __futex_abstimed_wait_common64 (private=128, cancel=true, abstime=0x0, op=265, expected=4058510, futex_word=0x7f675285c910) at ./nptl/futex-internal.c:57
	#1  __futex_abstimed_wait_common (cancel=true, private=128, abstime=0x0, clockid=0, expected=4058510, futex_word=0x7f675285c910) at ./nptl/futex-internal.c:87
	#2  __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x7f675285c910, expected=4058510, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=128) at ./nptl/futex-internal.c:139
	#3  0x00007f67529cd6a4 in __pthread_clockjoin_ex (threadid=140081742857792, thread_return=0x0, clockid=0, abstime=0x0, block=<optimized out>) at ./nptl/pthread_join_common.c:105
	#4  0x00007f6752d42337 in std::thread::join() () from /lib/x86_64-linux-gnu/libstdc++.so.6
	#5  0x000055775c5fa8e0 in SocketPoll::joinThread (this=0x55775cc9b090) at net/Socket.cpp:282
	#6  0x000055775c5c8121 in UnitBase::endTest (this=this@entry=0x55775cc0fe80, reason="") at common/Unit.cpp:545
	#7  0x00007f67528df61f in UnitWSDClient::endTest (this=0x55775cc0fe80, reason="") at ./UnitWSDClient.hpp:118
	#8  0x000055775c5cc4d1 in UnitBase::exitTest (this=0x55775cc0fe80, result=result@entry=UnitBase::TestResult::Ok, reason="") at common/Unit.cpp:486
	#9  0x00007f67528d1fa3 in UnitWOPIFileUrl::invokeWSDTest (this=0x55775cc0fe80) at UnitWOPIFileUrl.cpp:269
	#10 0x000055775c4accdb in UnitWSD::invokeTest (this=0x55775cc0fe80) at ./common/Unit.hpp:318
	#11 0x000055775c4a38cd in COOLWSD::innerMain (this=0x7ffd34248650) at wsd/COOLWSD.cpp:5459
	#12 0x000055775c4a59db in COOLWSD::main (this=<optimized out>) at wsd/COOLWSD.cpp:5706
	#13 0x00007f6753ab0877 in Poco::Util::Application::run() () from /lib/libPocoUtil.so.80
	#14 0x000055775c48316c in main (argc=14, argv=0x7ffd34248898) at wsd/COOLWSD.cpp:5845

Change-Id: If6162690462719f14a35241604f8a59b38a806c0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Ashod added a commit that referenced this pull request Nov 29, 2022
Since UnitBase (and children) are invoked from
different threads, UnitBase::exitTest could
have a race. This ultimately results in
invoking std::thread::join() concurrently,
which is unsafe. This can result in the
following deadlock.

In this case websrv_poll had invoked
UnitBase::exitTest concurrently and
evidently finished, leaving the main
coolwsd thread deadlocked.

	(gdb) info thread
	  Id   Target Id                                     Frame
	* 1    Thread 0x7f67528f0840 (LWP 4058508) "coolwsd" __futex_abstimed_wait_common64 (private=128, cancel=true, abstime=0x0, op=265, expected=4058510, futex_word=0x7f675285c910)
		at ./nptl/futex-internal.c:57
	(gdb) t a a bt

	Thread 1 (Thread 0x7f67528f0840 (LWP 4058508) "coolwsd"):
	#0  __futex_abstimed_wait_common64 (private=128, cancel=true, abstime=0x0, op=265, expected=4058510, futex_word=0x7f675285c910) at ./nptl/futex-internal.c:57
	#1  __futex_abstimed_wait_common (cancel=true, private=128, abstime=0x0, clockid=0, expected=4058510, futex_word=0x7f675285c910) at ./nptl/futex-internal.c:87
	#2  __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x7f675285c910, expected=4058510, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=128) at ./nptl/futex-internal.c:139
	#3  0x00007f67529cd6a4 in __pthread_clockjoin_ex (threadid=140081742857792, thread_return=0x0, clockid=0, abstime=0x0, block=<optimized out>) at ./nptl/pthread_join_common.c:105
	#4  0x00007f6752d42337 in std::thread::join() () from /lib/x86_64-linux-gnu/libstdc++.so.6
	#5  0x000055775c5fa8e0 in SocketPoll::joinThread (this=0x55775cc9b090) at net/Socket.cpp:282
	#6  0x000055775c5c8121 in UnitBase::endTest (this=this@entry=0x55775cc0fe80, reason="") at common/Unit.cpp:545
	#7  0x00007f67528df61f in UnitWSDClient::endTest (this=0x55775cc0fe80, reason="") at ./UnitWSDClient.hpp:118
	#8  0x000055775c5cc4d1 in UnitBase::exitTest (this=0x55775cc0fe80, result=result@entry=UnitBase::TestResult::Ok, reason="") at common/Unit.cpp:486
	#9  0x00007f67528d1fa3 in UnitWOPIFileUrl::invokeWSDTest (this=0x55775cc0fe80) at UnitWOPIFileUrl.cpp:269
	#10 0x000055775c4accdb in UnitWSD::invokeTest (this=0x55775cc0fe80) at ./common/Unit.hpp:318
	#11 0x000055775c4a38cd in COOLWSD::innerMain (this=0x7ffd34248650) at wsd/COOLWSD.cpp:5459
	#12 0x000055775c4a59db in COOLWSD::main (this=<optimized out>) at wsd/COOLWSD.cpp:5706
	#13 0x00007f6753ab0877 in Poco::Util::Application::run() () from /lib/libPocoUtil.so.80
	#14 0x000055775c48316c in main (argc=14, argv=0x7ffd34248898) at wsd/COOLWSD.cpp:5845

Change-Id: If6162690462719f14a35241604f8a59b38a806c0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Ashod added a commit that referenced this pull request Nov 30, 2022
Since UnitBase (and children) are invoked from
different threads, UnitBase::exitTest could
have a race. This ultimately results in
invoking std::thread::join() concurrently,
which is unsafe. This can result in the
following deadlock.

In this case websrv_poll had invoked
UnitBase::exitTest concurrently and
evidently finished, leaving the main
coolwsd thread deadlocked.

	(gdb) info thread
	  Id   Target Id                                     Frame
	* 1    Thread 0x7f67528f0840 (LWP 4058508) "coolwsd" __futex_abstimed_wait_common64 (private=128, cancel=true, abstime=0x0, op=265, expected=4058510, futex_word=0x7f675285c910)
		at ./nptl/futex-internal.c:57
	(gdb) t a a bt

	Thread 1 (Thread 0x7f67528f0840 (LWP 4058508) "coolwsd"):
	#0  __futex_abstimed_wait_common64 (private=128, cancel=true, abstime=0x0, op=265, expected=4058510, futex_word=0x7f675285c910) at ./nptl/futex-internal.c:57
	#1  __futex_abstimed_wait_common (cancel=true, private=128, abstime=0x0, clockid=0, expected=4058510, futex_word=0x7f675285c910) at ./nptl/futex-internal.c:87
	#2  __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x7f675285c910, expected=4058510, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=128) at ./nptl/futex-internal.c:139
	#3  0x00007f67529cd6a4 in __pthread_clockjoin_ex (threadid=140081742857792, thread_return=0x0, clockid=0, abstime=0x0, block=<optimized out>) at ./nptl/pthread_join_common.c:105
	#4  0x00007f6752d42337 in std::thread::join() () from /lib/x86_64-linux-gnu/libstdc++.so.6
	#5  0x000055775c5fa8e0 in SocketPoll::joinThread (this=0x55775cc9b090) at net/Socket.cpp:282
	#6  0x000055775c5c8121 in UnitBase::endTest (this=this@entry=0x55775cc0fe80, reason="") at common/Unit.cpp:545
	#7  0x00007f67528df61f in UnitWSDClient::endTest (this=0x55775cc0fe80, reason="") at ./UnitWSDClient.hpp:118
	#8  0x000055775c5cc4d1 in UnitBase::exitTest (this=0x55775cc0fe80, result=result@entry=UnitBase::TestResult::Ok, reason="") at common/Unit.cpp:486
	#9  0x00007f67528d1fa3 in UnitWOPIFileUrl::invokeWSDTest (this=0x55775cc0fe80) at UnitWOPIFileUrl.cpp:269
	#10 0x000055775c4accdb in UnitWSD::invokeTest (this=0x55775cc0fe80) at ./common/Unit.hpp:318
	#11 0x000055775c4a38cd in COOLWSD::innerMain (this=0x7ffd34248650) at wsd/COOLWSD.cpp:5459
	#12 0x000055775c4a59db in COOLWSD::main (this=<optimized out>) at wsd/COOLWSD.cpp:5706
	#13 0x00007f6753ab0877 in Poco::Util::Application::run() () from /lib/libPocoUtil.so.80
	#14 0x000055775c48316c in main (argc=14, argv=0x7ffd34248898) at wsd/COOLWSD.cpp:5845

Change-Id: If6162690462719f14a35241604f8a59b38a806c0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
emaisi pushed a commit to emaisi/online that referenced this pull request Dec 21, 2022
Since UnitBase (and children) are invoked from
different threads, UnitBase::exitTest could
have a race. This ultimately results in
invoking std::thread::join() concurrently,
which is unsafe. This can result in the
following deadlock.

In this case websrv_poll had invoked
UnitBase::exitTest concurrently and
evidently finished, leaving the main
coolwsd thread deadlocked.

	(gdb) info thread
	  Id   Target Id                                     Frame
	* 1    Thread 0x7f67528f0840 (LWP 4058508) "coolwsd" __futex_abstimed_wait_common64 (private=128, cancel=true, abstime=0x0, op=265, expected=4058510, futex_word=0x7f675285c910)
		at ./nptl/futex-internal.c:57
	(gdb) t a a bt

	Thread 1 (Thread 0x7f67528f0840 (LWP 4058508) "coolwsd"):
	#0  __futex_abstimed_wait_common64 (private=128, cancel=true, abstime=0x0, op=265, expected=4058510, futex_word=0x7f675285c910) at ./nptl/futex-internal.c:57
	CollaboraOnline#1  __futex_abstimed_wait_common (cancel=true, private=128, abstime=0x0, clockid=0, expected=4058510, futex_word=0x7f675285c910) at ./nptl/futex-internal.c:87
	CollaboraOnline#2  __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x7f675285c910, expected=4058510, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=128) at ./nptl/futex-internal.c:139
	CollaboraOnline#3  0x00007f67529cd6a4 in __pthread_clockjoin_ex (threadid=140081742857792, thread_return=0x0, clockid=0, abstime=0x0, block=<optimized out>) at ./nptl/pthread_join_common.c:105
	CollaboraOnline#4  0x00007f6752d42337 in std::thread::join() () from /lib/x86_64-linux-gnu/libstdc++.so.6
	CollaboraOnline#5  0x000055775c5fa8e0 in SocketPoll::joinThread (this=0x55775cc9b090) at net/Socket.cpp:282
	CollaboraOnline#6  0x000055775c5c8121 in UnitBase::endTest (this=this@entry=0x55775cc0fe80, reason="") at common/Unit.cpp:545
	CollaboraOnline#7  0x00007f67528df61f in UnitWSDClient::endTest (this=0x55775cc0fe80, reason="") at ./UnitWSDClient.hpp:118
	CollaboraOnline#8  0x000055775c5cc4d1 in UnitBase::exitTest (this=0x55775cc0fe80, result=result@entry=UnitBase::TestResult::Ok, reason="") at common/Unit.cpp:486
	CollaboraOnline#9  0x00007f67528d1fa3 in UnitWOPIFileUrl::invokeWSDTest (this=0x55775cc0fe80) at UnitWOPIFileUrl.cpp:269
	CollaboraOnline#10 0x000055775c4accdb in UnitWSD::invokeTest (this=0x55775cc0fe80) at ./common/Unit.hpp:318
	CollaboraOnline#11 0x000055775c4a38cd in COOLWSD::innerMain (this=0x7ffd34248650) at wsd/COOLWSD.cpp:5459
	CollaboraOnline#12 0x000055775c4a59db in COOLWSD::main (this=<optimized out>) at wsd/COOLWSD.cpp:5706
	CollaboraOnline#13 0x00007f6753ab0877 in Poco::Util::Application::run() () from /lib/libPocoUtil.so.80
	CollaboraOnline#14 0x000055775c48316c in main (argc=14, argv=0x7ffd34248898) at wsd/COOLWSD.cpp:5845

Change-Id: If6162690462719f14a35241604f8a59b38a806c0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
timar pushed a commit that referenced this pull request Dec 31, 2022
Since UnitBase (and children) are invoked from
different threads, UnitBase::exitTest could
have a race. This ultimately results in
invoking std::thread::join() concurrently,
which is unsafe. This can result in the
following deadlock.

In this case websrv_poll had invoked
UnitBase::exitTest concurrently and
evidently finished, leaving the main
coolwsd thread deadlocked.

	(gdb) info thread
	  Id   Target Id                                     Frame
	* 1    Thread 0x7f67528f0840 (LWP 4058508) "coolwsd" __futex_abstimed_wait_common64 (private=128, cancel=true, abstime=0x0, op=265, expected=4058510, futex_word=0x7f675285c910)
		at ./nptl/futex-internal.c:57
	(gdb) t a a bt

	Thread 1 (Thread 0x7f67528f0840 (LWP 4058508) "coolwsd"):
	#0  __futex_abstimed_wait_common64 (private=128, cancel=true, abstime=0x0, op=265, expected=4058510, futex_word=0x7f675285c910) at ./nptl/futex-internal.c:57
	#1  __futex_abstimed_wait_common (cancel=true, private=128, abstime=0x0, clockid=0, expected=4058510, futex_word=0x7f675285c910) at ./nptl/futex-internal.c:87
	#2  __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x7f675285c910, expected=4058510, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=128) at ./nptl/futex-internal.c:139
	#3  0x00007f67529cd6a4 in __pthread_clockjoin_ex (threadid=140081742857792, thread_return=0x0, clockid=0, abstime=0x0, block=<optimized out>) at ./nptl/pthread_join_common.c:105
	#4  0x00007f6752d42337 in std::thread::join() () from /lib/x86_64-linux-gnu/libstdc++.so.6
	#5  0x000055775c5fa8e0 in SocketPoll::joinThread (this=0x55775cc9b090) at net/Socket.cpp:282
	#6  0x000055775c5c8121 in UnitBase::endTest (this=this@entry=0x55775cc0fe80, reason="") at common/Unit.cpp:545
	#7  0x00007f67528df61f in UnitWSDClient::endTest (this=0x55775cc0fe80, reason="") at ./UnitWSDClient.hpp:118
	#8  0x000055775c5cc4d1 in UnitBase::exitTest (this=0x55775cc0fe80, result=result@entry=UnitBase::TestResult::Ok, reason="") at common/Unit.cpp:486
	#9  0x00007f67528d1fa3 in UnitWOPIFileUrl::invokeWSDTest (this=0x55775cc0fe80) at UnitWOPIFileUrl.cpp:269
	#10 0x000055775c4accdb in UnitWSD::invokeTest (this=0x55775cc0fe80) at ./common/Unit.hpp:318
	#11 0x000055775c4a38cd in COOLWSD::innerMain (this=0x7ffd34248650) at wsd/COOLWSD.cpp:5459
	#12 0x000055775c4a59db in COOLWSD::main (this=<optimized out>) at wsd/COOLWSD.cpp:5706
	#13 0x00007f6753ab0877 in Poco::Util::Application::run() () from /lib/libPocoUtil.so.80
	#14 0x000055775c48316c in main (argc=14, argv=0x7ffd34248898) at wsd/COOLWSD.cpp:5845

Change-Id: If6162690462719f14a35241604f8a59b38a806c0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
vmiklos added a commit that referenced this pull request Jan 9, 2024
terminate called after throwing an instance of 'Poco::JSON::JSONException'
...
    #11 0x7f70540e006a in Poco::JSON::ParserImpl::parseImpl(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) (/usr/lib64/libPocoJSON.so.92+0x4206a) (BuildId: 149b3c1772e35fcbe5692d435f1b06820707bad3)
    #12 0x556a70a9511b in Poco::JSON::Parser::parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) /usr/include/Poco/JSON/Parser.h:202:9
    #13 0x556a70a9511b in JsonUtil::parseJSON(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, Poco::SharedPtr<Poco::JSON::Object, Poco::ReferenceCounter, Poco::ReleasePolicy<Poco::JSON::Object>>&) /home/vmiklos/git/collaboraonline/online-fuzz/./common/JsonUtil.hpp:37:50
    #14 0x556a70a7edde in AdminSocketHandler::handleMessage(std::vector<char, std::allocator<char>> const&) /home/vmiklos/git/collaboraonline/online-fuzz/wsd/Admin.cpp:325:13

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Iebe0f5d689032a8b3c1e5d38c5ee80d344d1cbed
mmeeks pushed a commit that referenced this pull request Jan 9, 2024
terminate called after throwing an instance of 'Poco::JSON::JSONException'
...
    #11 0x7f70540e006a in Poco::JSON::ParserImpl::parseImpl(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) (/usr/lib64/libPocoJSON.so.92+0x4206a) (BuildId: 149b3c1772e35fcbe5692d435f1b06820707bad3)
    #12 0x556a70a9511b in Poco::JSON::Parser::parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) /usr/include/Poco/JSON/Parser.h:202:9
    #13 0x556a70a9511b in JsonUtil::parseJSON(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, Poco::SharedPtr<Poco::JSON::Object, Poco::ReferenceCounter, Poco::ReleasePolicy<Poco::JSON::Object>>&) /home/vmiklos/git/collaboraonline/online-fuzz/./common/JsonUtil.hpp:37:50
    #14 0x556a70a7edde in AdminSocketHandler::handleMessage(std::vector<char, std::allocator<char>> const&) /home/vmiklos/git/collaboraonline/online-fuzz/wsd/Admin.cpp:325:13

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Iebe0f5d689032a8b3c1e5d38c5ee80d344d1cbed
@mmeeks mmeeks mentioned this pull request Jun 13, 2024
caolanm added a commit that referenced this pull request Sep 26, 2024
at least one case of a crash in std::erase_if here.

 #1  0x00007f9d9b8d17f1 in __GI_abort () at abort.c:79
 #2  0x00000000005af591 in Poco::SignalHandler::handleSignal(int) [clone .cold] () at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/allocator.h:174
 #3  <signal handler called>
 #4  0x0000000000803115 in __gnu_cxx::__exchange_and_add (__val=-1, __mem=0x11) at /opt/rh/devtoolset-12/root/usr/include/c++/12/ext/atomicity.h:101
 #5  __gnu_cxx::__exchange_and_add_dispatch (__val=-1, __mem=0x11) at /opt/rh/devtoolset-12/root/usr/include/c++/12/ext/atomicity.h:101
 #6  std::string::_Rep::_M_dispose (__a=..., this=0x1) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/cow_string.h:288
 #7  std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string (this=0x7f9d7416a5c0, __in_chrg=<optimized out>)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/cow_string.h:718
 #8  std::destroy_at<std::string> (__location=0x7f9d7416a5c0) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:88
 #9  std::_Destroy<std::string> (__pointer=0x7f9d7416a5c0) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:149
 #10 std::_Destroy_aux<false>::__destroy<std::string*> (__last=0x7f9d7416a5d8, __first=0x7f9d7416a5c0) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:163
 #11 std::_Destroy<std::string*> (__last=0x7f9d7416a5d8, __first=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:196
 #12 std::_Destroy<std::string*, std::string> (__last=0x7f9d7416a5d8, __first=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/alloc_traits.h:850
 #13 std::vector<std::string, std::allocator<std::string> >::~vector (this=0x7f9d7c0fb9c8, __in_chrg=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:730
 #14 net::HostEntry::~HostEntry (this=0x7f9d7c0fb9b8, __in_chrg=<optimized out>) at net/NetUtil.cpp:127
 #15 0x00000000008083e9 in net::DNSCacheEntry::~DNSCacheEntry (this=0x7f9d7c0fb9a8, __in_chrg=<optimized out>) at net/NetUtil.cpp:129
 #16 std::destroy_at<net::DNSCacheEntry> (__location=0x7f9d7c0fb9a8) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:88
 #17 std::_Destroy<net::DNSCacheEntry> (__pointer=0x7f9d7c0fb9a8) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:149
 #18 std::_Destroy_aux<false>::__destroy<net::DNSCacheEntry*> (__last=<optimized out>, __first=0x7f9d7c0fb9a8) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:163
 #19 std::_Destroy<net::DNSCacheEntry*> (__last=<optimized out>, __first=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:196
 #20 std::_Destroy<net::DNSCacheEntry*, net::DNSCacheEntry> (__last=<optimized out>, __first=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/alloc_traits.h:850
 #21 std::vector<net::DNSCacheEntry, std::allocator<net::DNSCacheEntry> >::_M_erase_at_end (__pos=<optimized out>, this=<optimized out>)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:1932
 #22 std::vector<net::DNSCacheEntry, std::allocator<net::DNSCacheEntry> >::_M_erase (__last=..., __first=
       {queryAddress = "some.address.or.other", queryPort = "", hostEntry = {_requestName = "some.address.or.other", _canonicalName = "", _ipAddresses = std::vector of length 3, capacity 3 = {<error reading variable: Cannot access memory at address 0x1>, <error reading variable: Cannot access memory at address 0x1>, <error reading variable: Cannot access memory at address 0xffffffffffffffe8>}, _ainfo = std::shared_ptr<addrinfo> (use count 276, weak count -1) = {get() = 0x7f9d741ffd70}, _errno = 0, _eaino = 0}, lookupTime = {__d = {__r = 1035924226793350}}},
     this=0xef16a0 <net::resolveDNS(std::string const&)::resolver>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/vector.tcc:196
 #23 std::vector<net::DNSCacheEntry, std::allocator<net::DNSCacheEntry> >::erase (__last=..., __first=..., this=0xef16a0 <net::resolveDNS(std::string const&)::resolver>)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:1561
 #24 std::erase_if<net::DNSCacheEntry, std::allocator<net::DNSCacheEntry>, net::resolveDNS(const std::string&, const std::string&, std::vector<DNSCacheEntry>&)::<lambda(const auto:20&)> > (
     __pred=..., __cont=std::vector of length 2, capacity 8 = {...}) at /opt/rh/devtoolset-12/root/usr/include/c++/12/vector:117
 #25 net::resolveDNS(std::string const&, std::string const&, std::vector<net::DNSCacheEntry, std::allocator<net::DNSCacheEntry> >&) () at net/NetUtil.cpp:144
 #26 0x0000000000808f96 in net::DNSResolver::resolveDNS (port="", addressToCheck="some.address.or.other", this=0xef16a0 <net::resolveDNS(std::string const&)::resolver>) at net/NetUtil.cpp:171
 #27 net::resolveDNS(std::string const&) () at net/NetUtil.cpp:178
 #28 0x000000000080921a in net::resolveOneAddress(std::string const&) () at net/NetUtil.cpp:194
 #29 0x00000000008092e3 in net::resolveHostAddress(std::string const&) () at net/NetUtil.cpp:205
 #30 0x0000000000809354 in net::isLocalhost(std::string const&) () at net/NetUtil.cpp:227
 #31 0x0000000000811887 in SslStreamSocket::verifyCertificate() () at net/Socket.hpp:995
 #32 0x000000000082447b in SslStreamSocket::doHandshake (this=this@entry=0x7f9d7c18d0a0) at ./net/SslSocket.hpp:266
 #33 0x000000000082471b in SslStreamSocket::readIncomingData (this=0x7f9d7c18d0a0) at ./net/SslSocket.hpp:140
 #34 0x000000000081e02c in StreamSocket::handlePoll (this=0x7f9d7c18d0a0, disposition=..., now=..., events=1) at net/Socket.hpp:1348
 #35 0x0000000000816082 in SocketPoll::poll(long) () at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:1123
 #36 0x0000000000652250 in SocketPoll::poll (timeoutMax=..., this=<optimized out>) at ./net/Socket.hpp:689
 #37 DocumentBroker::pollThread() () at wsd/DocumentBroker.cpp:372
 #38 0x00000000008171a5 in SocketPoll::pollingThreadEntry() () at net/Socket.cpp:390
 #39 0x0000000000be1c83 in execute_native_thread_routine ()
 #40 0x00007f9d9bc896db in start_thread (arg=0x7f9d527fc700) at pthread_create.c:463
 #41 0x00007f9d9b9b274f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ie0d9e547dc9b4803ea95848c76302601a996c53a
vmiklos pushed a commit that referenced this pull request Sep 27, 2024
at least one case of a crash in std::erase_if here.

 #1  0x00007f9d9b8d17f1 in __GI_abort () at abort.c:79
 #2  0x00000000005af591 in Poco::SignalHandler::handleSignal(int) [clone .cold] () at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/allocator.h:174
 #3  <signal handler called>
 #4  0x0000000000803115 in __gnu_cxx::__exchange_and_add (__val=-1, __mem=0x11) at /opt/rh/devtoolset-12/root/usr/include/c++/12/ext/atomicity.h:101
 #5  __gnu_cxx::__exchange_and_add_dispatch (__val=-1, __mem=0x11) at /opt/rh/devtoolset-12/root/usr/include/c++/12/ext/atomicity.h:101
 #6  std::string::_Rep::_M_dispose (__a=..., this=0x1) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/cow_string.h:288
 #7  std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string (this=0x7f9d7416a5c0, __in_chrg=<optimized out>)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/cow_string.h:718
 #8  std::destroy_at<std::string> (__location=0x7f9d7416a5c0) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:88
 #9  std::_Destroy<std::string> (__pointer=0x7f9d7416a5c0) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:149
 #10 std::_Destroy_aux<false>::__destroy<std::string*> (__last=0x7f9d7416a5d8, __first=0x7f9d7416a5c0) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:163
 #11 std::_Destroy<std::string*> (__last=0x7f9d7416a5d8, __first=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:196
 #12 std::_Destroy<std::string*, std::string> (__last=0x7f9d7416a5d8, __first=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/alloc_traits.h:850
 #13 std::vector<std::string, std::allocator<std::string> >::~vector (this=0x7f9d7c0fb9c8, __in_chrg=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:730
 #14 net::HostEntry::~HostEntry (this=0x7f9d7c0fb9b8, __in_chrg=<optimized out>) at net/NetUtil.cpp:127
 #15 0x00000000008083e9 in net::DNSCacheEntry::~DNSCacheEntry (this=0x7f9d7c0fb9a8, __in_chrg=<optimized out>) at net/NetUtil.cpp:129
 #16 std::destroy_at<net::DNSCacheEntry> (__location=0x7f9d7c0fb9a8) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:88
 #17 std::_Destroy<net::DNSCacheEntry> (__pointer=0x7f9d7c0fb9a8) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:149
 #18 std::_Destroy_aux<false>::__destroy<net::DNSCacheEntry*> (__last=<optimized out>, __first=0x7f9d7c0fb9a8) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:163
 #19 std::_Destroy<net::DNSCacheEntry*> (__last=<optimized out>, __first=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:196
 #20 std::_Destroy<net::DNSCacheEntry*, net::DNSCacheEntry> (__last=<optimized out>, __first=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/alloc_traits.h:850
 #21 std::vector<net::DNSCacheEntry, std::allocator<net::DNSCacheEntry> >::_M_erase_at_end (__pos=<optimized out>, this=<optimized out>)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:1932
 #22 std::vector<net::DNSCacheEntry, std::allocator<net::DNSCacheEntry> >::_M_erase (__last=..., __first=
       {queryAddress = "some.address.or.other", queryPort = "", hostEntry = {_requestName = "some.address.or.other", _canonicalName = "", _ipAddresses = std::vector of length 3, capacity 3 = {<error reading variable: Cannot access memory at address 0x1>, <error reading variable: Cannot access memory at address 0x1>, <error reading variable: Cannot access memory at address 0xffffffffffffffe8>}, _ainfo = std::shared_ptr<addrinfo> (use count 276, weak count -1) = {get() = 0x7f9d741ffd70}, _errno = 0, _eaino = 0}, lookupTime = {__d = {__r = 1035924226793350}}},
     this=0xef16a0 <net::resolveDNS(std::string const&)::resolver>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/vector.tcc:196
 #23 std::vector<net::DNSCacheEntry, std::allocator<net::DNSCacheEntry> >::erase (__last=..., __first=..., this=0xef16a0 <net::resolveDNS(std::string const&)::resolver>)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:1561
 #24 std::erase_if<net::DNSCacheEntry, std::allocator<net::DNSCacheEntry>, net::resolveDNS(const std::string&, const std::string&, std::vector<DNSCacheEntry>&)::<lambda(const auto:20&)> > (
     __pred=..., __cont=std::vector of length 2, capacity 8 = {...}) at /opt/rh/devtoolset-12/root/usr/include/c++/12/vector:117
 #25 net::resolveDNS(std::string const&, std::string const&, std::vector<net::DNSCacheEntry, std::allocator<net::DNSCacheEntry> >&) () at net/NetUtil.cpp:144
 #26 0x0000000000808f96 in net::DNSResolver::resolveDNS (port="", addressToCheck="some.address.or.other", this=0xef16a0 <net::resolveDNS(std::string const&)::resolver>) at net/NetUtil.cpp:171
 #27 net::resolveDNS(std::string const&) () at net/NetUtil.cpp:178
 #28 0x000000000080921a in net::resolveOneAddress(std::string const&) () at net/NetUtil.cpp:194
 #29 0x00000000008092e3 in net::resolveHostAddress(std::string const&) () at net/NetUtil.cpp:205
 #30 0x0000000000809354 in net::isLocalhost(std::string const&) () at net/NetUtil.cpp:227
 #31 0x0000000000811887 in SslStreamSocket::verifyCertificate() () at net/Socket.hpp:995
 #32 0x000000000082447b in SslStreamSocket::doHandshake (this=this@entry=0x7f9d7c18d0a0) at ./net/SslSocket.hpp:266
 #33 0x000000000082471b in SslStreamSocket::readIncomingData (this=0x7f9d7c18d0a0) at ./net/SslSocket.hpp:140
 #34 0x000000000081e02c in StreamSocket::handlePoll (this=0x7f9d7c18d0a0, disposition=..., now=..., events=1) at net/Socket.hpp:1348
 #35 0x0000000000816082 in SocketPoll::poll(long) () at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:1123
 #36 0x0000000000652250 in SocketPoll::poll (timeoutMax=..., this=<optimized out>) at ./net/Socket.hpp:689
 #37 DocumentBroker::pollThread() () at wsd/DocumentBroker.cpp:372
 #38 0x00000000008171a5 in SocketPoll::pollingThreadEntry() () at net/Socket.cpp:390
 #39 0x0000000000be1c83 in execute_native_thread_routine ()
 #40 0x00007f9d9bc896db in start_thread (arg=0x7f9d527fc700) at pthread_create.c:463
 #41 0x00007f9d9b9b274f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ie0d9e547dc9b4803ea95848c76302601a996c53a
timar pushed a commit that referenced this pull request Sep 29, 2024
at least one case of a crash in std::erase_if here.

 #1  0x00007f9d9b8d17f1 in __GI_abort () at abort.c:79
 #2  0x00000000005af591 in Poco::SignalHandler::handleSignal(int) [clone .cold] () at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/allocator.h:174
 #3  <signal handler called>
 #4  0x0000000000803115 in __gnu_cxx::__exchange_and_add (__val=-1, __mem=0x11) at /opt/rh/devtoolset-12/root/usr/include/c++/12/ext/atomicity.h:101
 #5  __gnu_cxx::__exchange_and_add_dispatch (__val=-1, __mem=0x11) at /opt/rh/devtoolset-12/root/usr/include/c++/12/ext/atomicity.h:101
 #6  std::string::_Rep::_M_dispose (__a=..., this=0x1) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/cow_string.h:288
 #7  std::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string (this=0x7f9d7416a5c0, __in_chrg=<optimized out>)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/cow_string.h:718
 #8  std::destroy_at<std::string> (__location=0x7f9d7416a5c0) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:88
 #9  std::_Destroy<std::string> (__pointer=0x7f9d7416a5c0) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:149
 #10 std::_Destroy_aux<false>::__destroy<std::string*> (__last=0x7f9d7416a5d8, __first=0x7f9d7416a5c0) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:163
 #11 std::_Destroy<std::string*> (__last=0x7f9d7416a5d8, __first=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:196
 #12 std::_Destroy<std::string*, std::string> (__last=0x7f9d7416a5d8, __first=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/alloc_traits.h:850
 #13 std::vector<std::string, std::allocator<std::string> >::~vector (this=0x7f9d7c0fb9c8, __in_chrg=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:730
 #14 net::HostEntry::~HostEntry (this=0x7f9d7c0fb9b8, __in_chrg=<optimized out>) at net/NetUtil.cpp:127
 #15 0x00000000008083e9 in net::DNSCacheEntry::~DNSCacheEntry (this=0x7f9d7c0fb9a8, __in_chrg=<optimized out>) at net/NetUtil.cpp:129
 #16 std::destroy_at<net::DNSCacheEntry> (__location=0x7f9d7c0fb9a8) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:88
 #17 std::_Destroy<net::DNSCacheEntry> (__pointer=0x7f9d7c0fb9a8) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:149
 #18 std::_Destroy_aux<false>::__destroy<net::DNSCacheEntry*> (__last=<optimized out>, __first=0x7f9d7c0fb9a8) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:163
 #19 std::_Destroy<net::DNSCacheEntry*> (__last=<optimized out>, __first=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_construct.h:196
 #20 std::_Destroy<net::DNSCacheEntry*, net::DNSCacheEntry> (__last=<optimized out>, __first=<optimized out>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/alloc_traits.h:850
 #21 std::vector<net::DNSCacheEntry, std::allocator<net::DNSCacheEntry> >::_M_erase_at_end (__pos=<optimized out>, this=<optimized out>)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:1932
 #22 std::vector<net::DNSCacheEntry, std::allocator<net::DNSCacheEntry> >::_M_erase (__last=..., __first=
       {queryAddress = "some.address.or.other", queryPort = "", hostEntry = {_requestName = "some.address.or.other", _canonicalName = "", _ipAddresses = std::vector of length 3, capacity 3 = {<error reading variable: Cannot access memory at address 0x1>, <error reading variable: Cannot access memory at address 0x1>, <error reading variable: Cannot access memory at address 0xffffffffffffffe8>}, _ainfo = std::shared_ptr<addrinfo> (use count 276, weak count -1) = {get() = 0x7f9d741ffd70}, _errno = 0, _eaino = 0}, lookupTime = {__d = {__r = 1035924226793350}}},
     this=0xef16a0 <net::resolveDNS(std::string const&)::resolver>) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/vector.tcc:196
 #23 std::vector<net::DNSCacheEntry, std::allocator<net::DNSCacheEntry> >::erase (__last=..., __first=..., this=0xef16a0 <net::resolveDNS(std::string const&)::resolver>)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:1561
 #24 std::erase_if<net::DNSCacheEntry, std::allocator<net::DNSCacheEntry>, net::resolveDNS(const std::string&, const std::string&, std::vector<DNSCacheEntry>&)::<lambda(const auto:20&)> > (
     __pred=..., __cont=std::vector of length 2, capacity 8 = {...}) at /opt/rh/devtoolset-12/root/usr/include/c++/12/vector:117
 #25 net::resolveDNS(std::string const&, std::string const&, std::vector<net::DNSCacheEntry, std::allocator<net::DNSCacheEntry> >&) () at net/NetUtil.cpp:144
 #26 0x0000000000808f96 in net::DNSResolver::resolveDNS (port="", addressToCheck="some.address.or.other", this=0xef16a0 <net::resolveDNS(std::string const&)::resolver>) at net/NetUtil.cpp:171
 #27 net::resolveDNS(std::string const&) () at net/NetUtil.cpp:178
 #28 0x000000000080921a in net::resolveOneAddress(std::string const&) () at net/NetUtil.cpp:194
 #29 0x00000000008092e3 in net::resolveHostAddress(std::string const&) () at net/NetUtil.cpp:205
 #30 0x0000000000809354 in net::isLocalhost(std::string const&) () at net/NetUtil.cpp:227
 #31 0x0000000000811887 in SslStreamSocket::verifyCertificate() () at net/Socket.hpp:995
 #32 0x000000000082447b in SslStreamSocket::doHandshake (this=this@entry=0x7f9d7c18d0a0) at ./net/SslSocket.hpp:266
 #33 0x000000000082471b in SslStreamSocket::readIncomingData (this=0x7f9d7c18d0a0) at ./net/SslSocket.hpp:140
 #34 0x000000000081e02c in StreamSocket::handlePoll (this=0x7f9d7c18d0a0, disposition=..., now=..., events=1) at net/Socket.hpp:1348
 #35 0x0000000000816082 in SocketPoll::poll(long) () at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:1123
 #36 0x0000000000652250 in SocketPoll::poll (timeoutMax=..., this=<optimized out>) at ./net/Socket.hpp:689
 #37 DocumentBroker::pollThread() () at wsd/DocumentBroker.cpp:372
 #38 0x00000000008171a5 in SocketPoll::pollingThreadEntry() () at net/Socket.cpp:390
 #39 0x0000000000be1c83 in execute_native_thread_routine ()
 #40 0x00007f9d9bc896db in start_thread (arg=0x7f9d527fc700) at pthread_create.c:463
 #41 0x00007f9d9b9b274f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ie0d9e547dc9b4803ea95848c76302601a996c53a
caolanm added a commit that referenced this pull request Oct 29, 2024
we lock this elsewhere when writing

READ of size 4 at 0x60300016be38 thread T7 (docbroker_001)
    #0 0x1ab5b94 in SocketPoll::wakeupWorld() builddir/online/net/Socket.cpp:764:16
    #1 0x14cc7e9 in DocumentBroker::DocumentBrokerPoll::pollingThread() builddir/online/wsd/DocumentBroker.cpp:153:9
    #2 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #3 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #4 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #5 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #6 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #7 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #8 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
    #9 0x7f0fddfd76e9 in start_thread (/lib64/libpthread.so.0+0xa6e9)
    #10 0x7f0fddcc149e in clone (/lib64/libc.so.6+0x11849e)
0x60300016be38 is located 24 bytes inside of 32-byte region [0x60300016be20,0x60300016be40)
freed by thread T3 (remotefontconfi) here:
    #0 0xac9a98 in operator delete(void*, unsigned long) llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_new_delete.cpp:172:3
    #1 0xbf49ad in std::__new_allocator<int>::deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/new_allocator.h:158:2
    #2 0xbf494d in std::allocator<int>::deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/allocator.h:200:25
    #3 0xbf494d in std::allocator_traits<std::allocator<int>>::deallocate(std::allocator<int>&, int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/alloc_traits.h:496:13
    #4 0xbf4874 in std::_Vector_base<int, std::allocator<int>>::_M_deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:387:4
    #5 0x19d624b in void std::vector<int, std::allocator<int>>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/vector.tcc:513:7
    #6 0x19b95bd in std::vector<int, std::allocator<int>>::push_back(int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1287:4
    #7 0x1a922fe in SocketPoll::createWakeups() builddir/online/net/Socket.cpp:857:23
    #8 0x1a90dd2 in SocketPoll::SocketPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>) builddir/online/net/Socket.cpp:336:5
    #9 0xf62703 in TerminatingPoll::TerminatingPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) builddir/online/./net/Socket.hpp:1046:9
    #10 0xf5e4fa in http::Session::syncRequest(http::Request const&) builddir/online/./net/HttpRequest.hpp:1284:25
    #11 0xf58d58 in RemoteJSONPoll::pollingThread() builddir/online/wsd/COOLWSD.cpp:1139:38
    #12 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #13 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #14 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #15 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #16 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #17 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #18 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
previously allocated by thread T0 here:
    #0 0xac8b98 in operator new(unsigned long) llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_new_delete.cpp:99:3
    #1 0xccfd04 in std::__new_allocator<int>::allocate(unsigned long, void const*) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/new_allocator.h:137:27
    #2 0xccfc31 in std::allocator<int>::allocate(unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/allocator.h:188:32
    #3 0xccfc31 in std::allocator_traits<std::allocator<int>>::allocate(std::allocator<int>&, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/alloc_traits.h:464:20
    #4 0xccf4ec in std::_Vector_base<int, std::allocator<int>>::_M_allocate(unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:378:20
    #5 0x19d5c65 in void std::vector<int, std::allocator<int>>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/vector.tcc:453:33
    #6 0x19b95bd in std::vector<int, std::allocator<int>>::push_back(int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1287:4
    #7 0x1a922fe in SocketPoll::createWakeups() builddir/online/net/Socket.cpp:857:23
    #8 0x1a90dd2 in SocketPoll::SocketPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>) builddir/online/net/Socket.cpp:336:5
    #9 0xf57119 in RemoteJSONPoll::RemoteJSONPoll(Poco::Util::LayeredConfiguration&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) builddir/online/wsd/COOLWSD.cpp:1071:11
    #10 0xef24ce in RemoteConfigPoll::RemoteConfigPoll(Poco::Util::LayeredConfiguration&) builddir/online/wsd/COOLWSD.cpp:1203:9
    #11 0xe94fef in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4351:22
    #12 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #13 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #14 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #15 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #16 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #17 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)
Thread T7 (docbroker_001) created by T5 (websrv_poll) here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0x1ab4f13 in SocketDisposition::execute() builddir/online/net/Socket.cpp:1060:22
    #4 0x1ab1525 in SocketPoll::poll(long) builddir/online/net/Socket.cpp:708:29
    #5 0xb668e2 in SocketPoll::poll(std::chrono::duration<long, std::ratio<1l, 1000000l>>) builddir/online/./net/Socket.hpp:777:61
    #6 0xf09d67 in SocketPoll::pollingThread() builddir/online/./net/Socket.hpp:950:13
    #7 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #8 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #9 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #10 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #11 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #12 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #13 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
Thread T5 (websrv_poll) created by T0 here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0xef5b24 in COOLWSDServer::start() builddir/online/wsd/COOLWSD.cpp:4033:24
    #4 0xe9d04c in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4483:13
    #5 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #6 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #7 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #8 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #9 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #10 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)
Thread T3 (remotefontconfi) created by T0 here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0xef3dbb in RemoteJSONPoll::start() builddir/online/wsd/COOLWSD.cpp:1104:9
    #4 0xe9c767 in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4471:33
    #5 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #6 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #7 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #8 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #9 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #10 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5aad074ffa06408ff7055046a5ba6d8674aec31d
mmeeks pushed a commit that referenced this pull request Oct 29, 2024
we lock this elsewhere when writing

READ of size 4 at 0x60300016be38 thread T7 (docbroker_001)
    #0 0x1ab5b94 in SocketPoll::wakeupWorld() builddir/online/net/Socket.cpp:764:16
    #1 0x14cc7e9 in DocumentBroker::DocumentBrokerPoll::pollingThread() builddir/online/wsd/DocumentBroker.cpp:153:9
    #2 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #3 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #4 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #5 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #6 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #7 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #8 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
    #9 0x7f0fddfd76e9 in start_thread (/lib64/libpthread.so.0+0xa6e9)
    #10 0x7f0fddcc149e in clone (/lib64/libc.so.6+0x11849e)
0x60300016be38 is located 24 bytes inside of 32-byte region [0x60300016be20,0x60300016be40)
freed by thread T3 (remotefontconfi) here:
    #0 0xac9a98 in operator delete(void*, unsigned long) llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_new_delete.cpp:172:3
    #1 0xbf49ad in std::__new_allocator<int>::deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/new_allocator.h:158:2
    #2 0xbf494d in std::allocator<int>::deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/allocator.h:200:25
    #3 0xbf494d in std::allocator_traits<std::allocator<int>>::deallocate(std::allocator<int>&, int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/alloc_traits.h:496:13
    #4 0xbf4874 in std::_Vector_base<int, std::allocator<int>>::_M_deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:387:4
    #5 0x19d624b in void std::vector<int, std::allocator<int>>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/vector.tcc:513:7
    #6 0x19b95bd in std::vector<int, std::allocator<int>>::push_back(int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1287:4
    #7 0x1a922fe in SocketPoll::createWakeups() builddir/online/net/Socket.cpp:857:23
    #8 0x1a90dd2 in SocketPoll::SocketPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>) builddir/online/net/Socket.cpp:336:5
    #9 0xf62703 in TerminatingPoll::TerminatingPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) builddir/online/./net/Socket.hpp:1046:9
    #10 0xf5e4fa in http::Session::syncRequest(http::Request const&) builddir/online/./net/HttpRequest.hpp:1284:25
    #11 0xf58d58 in RemoteJSONPoll::pollingThread() builddir/online/wsd/COOLWSD.cpp:1139:38
    #12 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #13 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #14 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #15 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #16 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #17 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #18 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
previously allocated by thread T0 here:
    #0 0xac8b98 in operator new(unsigned long) llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_new_delete.cpp:99:3
    #1 0xccfd04 in std::__new_allocator<int>::allocate(unsigned long, void const*) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/new_allocator.h:137:27
    #2 0xccfc31 in std::allocator<int>::allocate(unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/allocator.h:188:32
    #3 0xccfc31 in std::allocator_traits<std::allocator<int>>::allocate(std::allocator<int>&, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/alloc_traits.h:464:20
    #4 0xccf4ec in std::_Vector_base<int, std::allocator<int>>::_M_allocate(unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:378:20
    #5 0x19d5c65 in void std::vector<int, std::allocator<int>>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/vector.tcc:453:33
    #6 0x19b95bd in std::vector<int, std::allocator<int>>::push_back(int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1287:4
    #7 0x1a922fe in SocketPoll::createWakeups() builddir/online/net/Socket.cpp:857:23
    #8 0x1a90dd2 in SocketPoll::SocketPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>) builddir/online/net/Socket.cpp:336:5
    #9 0xf57119 in RemoteJSONPoll::RemoteJSONPoll(Poco::Util::LayeredConfiguration&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) builddir/online/wsd/COOLWSD.cpp:1071:11
    #10 0xef24ce in RemoteConfigPoll::RemoteConfigPoll(Poco::Util::LayeredConfiguration&) builddir/online/wsd/COOLWSD.cpp:1203:9
    #11 0xe94fef in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4351:22
    #12 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #13 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #14 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #15 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #16 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #17 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)
Thread T7 (docbroker_001) created by T5 (websrv_poll) here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0x1ab4f13 in SocketDisposition::execute() builddir/online/net/Socket.cpp:1060:22
    #4 0x1ab1525 in SocketPoll::poll(long) builddir/online/net/Socket.cpp:708:29
    #5 0xb668e2 in SocketPoll::poll(std::chrono::duration<long, std::ratio<1l, 1000000l>>) builddir/online/./net/Socket.hpp:777:61
    #6 0xf09d67 in SocketPoll::pollingThread() builddir/online/./net/Socket.hpp:950:13
    #7 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #8 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #9 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #10 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #11 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #12 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #13 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
Thread T5 (websrv_poll) created by T0 here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0xef5b24 in COOLWSDServer::start() builddir/online/wsd/COOLWSD.cpp:4033:24
    #4 0xe9d04c in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4483:13
    #5 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #6 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #7 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #8 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #9 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #10 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)
Thread T3 (remotefontconfi) created by T0 here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0xef3dbb in RemoteJSONPoll::start() builddir/online/wsd/COOLWSD.cpp:1104:9
    #4 0xe9c767 in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4471:33
    #5 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #6 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #7 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #8 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #9 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #10 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5aad074ffa06408ff7055046a5ba6d8674aec31d
caolanm added a commit that referenced this pull request Oct 29, 2024
we lock this elsewhere when writing

READ of size 4 at 0x60300016be38 thread T7 (docbroker_001)
    #0 0x1ab5b94 in SocketPoll::wakeupWorld() builddir/online/net/Socket.cpp:764:16
    #1 0x14cc7e9 in DocumentBroker::DocumentBrokerPoll::pollingThread() builddir/online/wsd/DocumentBroker.cpp:153:9
    #2 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #3 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #4 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #5 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #6 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #7 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #8 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
    #9 0x7f0fddfd76e9 in start_thread (/lib64/libpthread.so.0+0xa6e9)
    #10 0x7f0fddcc149e in clone (/lib64/libc.so.6+0x11849e)
0x60300016be38 is located 24 bytes inside of 32-byte region [0x60300016be20,0x60300016be40)
freed by thread T3 (remotefontconfi) here:
    #0 0xac9a98 in operator delete(void*, unsigned long) llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_new_delete.cpp:172:3
    #1 0xbf49ad in std::__new_allocator<int>::deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/new_allocator.h:158:2
    #2 0xbf494d in std::allocator<int>::deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/allocator.h:200:25
    #3 0xbf494d in std::allocator_traits<std::allocator<int>>::deallocate(std::allocator<int>&, int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/alloc_traits.h:496:13
    #4 0xbf4874 in std::_Vector_base<int, std::allocator<int>>::_M_deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:387:4
    #5 0x19d624b in void std::vector<int, std::allocator<int>>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/vector.tcc:513:7
    #6 0x19b95bd in std::vector<int, std::allocator<int>>::push_back(int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1287:4
    #7 0x1a922fe in SocketPoll::createWakeups() builddir/online/net/Socket.cpp:857:23
    #8 0x1a90dd2 in SocketPoll::SocketPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>) builddir/online/net/Socket.cpp:336:5
    #9 0xf62703 in TerminatingPoll::TerminatingPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) builddir/online/./net/Socket.hpp:1046:9
    #10 0xf5e4fa in http::Session::syncRequest(http::Request const&) builddir/online/./net/HttpRequest.hpp:1284:25
    #11 0xf58d58 in RemoteJSONPoll::pollingThread() builddir/online/wsd/COOLWSD.cpp:1139:38
    #12 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #13 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #14 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #15 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #16 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #17 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #18 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
previously allocated by thread T0 here:
    #0 0xac8b98 in operator new(unsigned long) llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_new_delete.cpp:99:3
    #1 0xccfd04 in std::__new_allocator<int>::allocate(unsigned long, void const*) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/new_allocator.h:137:27
    #2 0xccfc31 in std::allocator<int>::allocate(unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/allocator.h:188:32
    #3 0xccfc31 in std::allocator_traits<std::allocator<int>>::allocate(std::allocator<int>&, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/alloc_traits.h:464:20
    #4 0xccf4ec in std::_Vector_base<int, std::allocator<int>>::_M_allocate(unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:378:20
    #5 0x19d5c65 in void std::vector<int, std::allocator<int>>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/vector.tcc:453:33
    #6 0x19b95bd in std::vector<int, std::allocator<int>>::push_back(int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1287:4
    #7 0x1a922fe in SocketPoll::createWakeups() builddir/online/net/Socket.cpp:857:23
    #8 0x1a90dd2 in SocketPoll::SocketPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>) builddir/online/net/Socket.cpp:336:5
    #9 0xf57119 in RemoteJSONPoll::RemoteJSONPoll(Poco::Util::LayeredConfiguration&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) builddir/online/wsd/COOLWSD.cpp:1071:11
    #10 0xef24ce in RemoteConfigPoll::RemoteConfigPoll(Poco::Util::LayeredConfiguration&) builddir/online/wsd/COOLWSD.cpp:1203:9
    #11 0xe94fef in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4351:22
    #12 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #13 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #14 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #15 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #16 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #17 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)
Thread T7 (docbroker_001) created by T5 (websrv_poll) here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0x1ab4f13 in SocketDisposition::execute() builddir/online/net/Socket.cpp:1060:22
    #4 0x1ab1525 in SocketPoll::poll(long) builddir/online/net/Socket.cpp:708:29
    #5 0xb668e2 in SocketPoll::poll(std::chrono::duration<long, std::ratio<1l, 1000000l>>) builddir/online/./net/Socket.hpp:777:61
    #6 0xf09d67 in SocketPoll::pollingThread() builddir/online/./net/Socket.hpp:950:13
    #7 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #8 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #9 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #10 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #11 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #12 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #13 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
Thread T5 (websrv_poll) created by T0 here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0xef5b24 in COOLWSDServer::start() builddir/online/wsd/COOLWSD.cpp:4033:24
    #4 0xe9d04c in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4483:13
    #5 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #6 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #7 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #8 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #9 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #10 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)
Thread T3 (remotefontconfi) created by T0 here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0xef3dbb in RemoteJSONPoll::start() builddir/online/wsd/COOLWSD.cpp:1104:9
    #4 0xe9c767 in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4471:33
    #5 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #6 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #7 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #8 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #9 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #10 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5aad074ffa06408ff7055046a5ba6d8674aec31d
(cherry picked from commit ce908e9)
caolanm added a commit that referenced this pull request Oct 30, 2024
we lock this elsewhere when writing

READ of size 4 at 0x60300016be38 thread T7 (docbroker_001)
    #0 0x1ab5b94 in SocketPoll::wakeupWorld() builddir/online/net/Socket.cpp:764:16
    #1 0x14cc7e9 in DocumentBroker::DocumentBrokerPoll::pollingThread() builddir/online/wsd/DocumentBroker.cpp:153:9
    #2 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #3 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #4 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #5 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #6 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #7 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #8 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
    #9 0x7f0fddfd76e9 in start_thread (/lib64/libpthread.so.0+0xa6e9)
    #10 0x7f0fddcc149e in clone (/lib64/libc.so.6+0x11849e)
0x60300016be38 is located 24 bytes inside of 32-byte region [0x60300016be20,0x60300016be40)
freed by thread T3 (remotefontconfi) here:
    #0 0xac9a98 in operator delete(void*, unsigned long) llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_new_delete.cpp:172:3
    #1 0xbf49ad in std::__new_allocator<int>::deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/new_allocator.h:158:2
    #2 0xbf494d in std::allocator<int>::deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/allocator.h:200:25
    #3 0xbf494d in std::allocator_traits<std::allocator<int>>::deallocate(std::allocator<int>&, int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/alloc_traits.h:496:13
    #4 0xbf4874 in std::_Vector_base<int, std::allocator<int>>::_M_deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:387:4
    #5 0x19d624b in void std::vector<int, std::allocator<int>>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/vector.tcc:513:7
    #6 0x19b95bd in std::vector<int, std::allocator<int>>::push_back(int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1287:4
    #7 0x1a922fe in SocketPoll::createWakeups() builddir/online/net/Socket.cpp:857:23
    #8 0x1a90dd2 in SocketPoll::SocketPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>) builddir/online/net/Socket.cpp:336:5
    #9 0xf62703 in TerminatingPoll::TerminatingPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) builddir/online/./net/Socket.hpp:1046:9
    #10 0xf5e4fa in http::Session::syncRequest(http::Request const&) builddir/online/./net/HttpRequest.hpp:1284:25
    #11 0xf58d58 in RemoteJSONPoll::pollingThread() builddir/online/wsd/COOLWSD.cpp:1139:38
    #12 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #13 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #14 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #15 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #16 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #17 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #18 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
previously allocated by thread T0 here:
    #0 0xac8b98 in operator new(unsigned long) llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_new_delete.cpp:99:3
    #1 0xccfd04 in std::__new_allocator<int>::allocate(unsigned long, void const*) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/new_allocator.h:137:27
    #2 0xccfc31 in std::allocator<int>::allocate(unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/allocator.h:188:32
    #3 0xccfc31 in std::allocator_traits<std::allocator<int>>::allocate(std::allocator<int>&, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/alloc_traits.h:464:20
    #4 0xccf4ec in std::_Vector_base<int, std::allocator<int>>::_M_allocate(unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:378:20
    #5 0x19d5c65 in void std::vector<int, std::allocator<int>>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/vector.tcc:453:33
    #6 0x19b95bd in std::vector<int, std::allocator<int>>::push_back(int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1287:4
    #7 0x1a922fe in SocketPoll::createWakeups() builddir/online/net/Socket.cpp:857:23
    #8 0x1a90dd2 in SocketPoll::SocketPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>) builddir/online/net/Socket.cpp:336:5
    #9 0xf57119 in RemoteJSONPoll::RemoteJSONPoll(Poco::Util::LayeredConfiguration&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) builddir/online/wsd/COOLWSD.cpp:1071:11
    #10 0xef24ce in RemoteConfigPoll::RemoteConfigPoll(Poco::Util::LayeredConfiguration&) builddir/online/wsd/COOLWSD.cpp:1203:9
    #11 0xe94fef in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4351:22
    #12 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #13 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #14 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #15 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #16 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #17 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)
Thread T7 (docbroker_001) created by T5 (websrv_poll) here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0x1ab4f13 in SocketDisposition::execute() builddir/online/net/Socket.cpp:1060:22
    #4 0x1ab1525 in SocketPoll::poll(long) builddir/online/net/Socket.cpp:708:29
    #5 0xb668e2 in SocketPoll::poll(std::chrono::duration<long, std::ratio<1l, 1000000l>>) builddir/online/./net/Socket.hpp:777:61
    #6 0xf09d67 in SocketPoll::pollingThread() builddir/online/./net/Socket.hpp:950:13
    #7 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #8 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #9 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #10 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #11 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #12 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #13 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
Thread T5 (websrv_poll) created by T0 here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0xef5b24 in COOLWSDServer::start() builddir/online/wsd/COOLWSD.cpp:4033:24
    #4 0xe9d04c in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4483:13
    #5 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #6 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #7 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #8 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #9 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #10 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)
Thread T3 (remotefontconfi) created by T0 here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0xef3dbb in RemoteJSONPoll::start() builddir/online/wsd/COOLWSD.cpp:1104:9
    #4 0xe9c767 in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4471:33
    #5 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #6 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #7 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #8 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #9 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #10 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5aad074ffa06408ff7055046a5ba6d8674aec31d
(cherry picked from commit ce908e9)
caolanm added a commit that referenced this pull request Oct 30, 2024
we lock this elsewhere when writing

READ of size 4 at 0x60300016be38 thread T7 (docbroker_001)
    #0 0x1ab5b94 in SocketPoll::wakeupWorld() builddir/online/net/Socket.cpp:764:16
    #1 0x14cc7e9 in DocumentBroker::DocumentBrokerPoll::pollingThread() builddir/online/wsd/DocumentBroker.cpp:153:9
    #2 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #3 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #4 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #5 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #6 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #7 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #8 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
    #9 0x7f0fddfd76e9 in start_thread (/lib64/libpthread.so.0+0xa6e9)
    #10 0x7f0fddcc149e in clone (/lib64/libc.so.6+0x11849e)
0x60300016be38 is located 24 bytes inside of 32-byte region [0x60300016be20,0x60300016be40)
freed by thread T3 (remotefontconfi) here:
    #0 0xac9a98 in operator delete(void*, unsigned long) llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_new_delete.cpp:172:3
    #1 0xbf49ad in std::__new_allocator<int>::deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/new_allocator.h:158:2
    #2 0xbf494d in std::allocator<int>::deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/allocator.h:200:25
    #3 0xbf494d in std::allocator_traits<std::allocator<int>>::deallocate(std::allocator<int>&, int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/alloc_traits.h:496:13
    #4 0xbf4874 in std::_Vector_base<int, std::allocator<int>>::_M_deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:387:4
    #5 0x19d624b in void std::vector<int, std::allocator<int>>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/vector.tcc:513:7
    #6 0x19b95bd in std::vector<int, std::allocator<int>>::push_back(int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1287:4
    #7 0x1a922fe in SocketPoll::createWakeups() builddir/online/net/Socket.cpp:857:23
    #8 0x1a90dd2 in SocketPoll::SocketPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>) builddir/online/net/Socket.cpp:336:5
    #9 0xf62703 in TerminatingPoll::TerminatingPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) builddir/online/./net/Socket.hpp:1046:9
    #10 0xf5e4fa in http::Session::syncRequest(http::Request const&) builddir/online/./net/HttpRequest.hpp:1284:25
    #11 0xf58d58 in RemoteJSONPoll::pollingThread() builddir/online/wsd/COOLWSD.cpp:1139:38
    #12 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #13 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #14 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #15 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #16 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #17 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #18 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
previously allocated by thread T0 here:
    #0 0xac8b98 in operator new(unsigned long) llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_new_delete.cpp:99:3
    #1 0xccfd04 in std::__new_allocator<int>::allocate(unsigned long, void const*) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/new_allocator.h:137:27
    #2 0xccfc31 in std::allocator<int>::allocate(unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/allocator.h:188:32
    #3 0xccfc31 in std::allocator_traits<std::allocator<int>>::allocate(std::allocator<int>&, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/alloc_traits.h:464:20
    #4 0xccf4ec in std::_Vector_base<int, std::allocator<int>>::_M_allocate(unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:378:20
    #5 0x19d5c65 in void std::vector<int, std::allocator<int>>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/vector.tcc:453:33
    #6 0x19b95bd in std::vector<int, std::allocator<int>>::push_back(int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1287:4
    #7 0x1a922fe in SocketPoll::createWakeups() builddir/online/net/Socket.cpp:857:23
    #8 0x1a90dd2 in SocketPoll::SocketPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>) builddir/online/net/Socket.cpp:336:5
    #9 0xf57119 in RemoteJSONPoll::RemoteJSONPoll(Poco::Util::LayeredConfiguration&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) builddir/online/wsd/COOLWSD.cpp:1071:11
    #10 0xef24ce in RemoteConfigPoll::RemoteConfigPoll(Poco::Util::LayeredConfiguration&) builddir/online/wsd/COOLWSD.cpp:1203:9
    #11 0xe94fef in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4351:22
    #12 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #13 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #14 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #15 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #16 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #17 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)
Thread T7 (docbroker_001) created by T5 (websrv_poll) here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0x1ab4f13 in SocketDisposition::execute() builddir/online/net/Socket.cpp:1060:22
    #4 0x1ab1525 in SocketPoll::poll(long) builddir/online/net/Socket.cpp:708:29
    #5 0xb668e2 in SocketPoll::poll(std::chrono::duration<long, std::ratio<1l, 1000000l>>) builddir/online/./net/Socket.hpp:777:61
    #6 0xf09d67 in SocketPoll::pollingThread() builddir/online/./net/Socket.hpp:950:13
    #7 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #8 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #9 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #10 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #11 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #12 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #13 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
Thread T5 (websrv_poll) created by T0 here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0xef5b24 in COOLWSDServer::start() builddir/online/wsd/COOLWSD.cpp:4033:24
    #4 0xe9d04c in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4483:13
    #5 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #6 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #7 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #8 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #9 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #10 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)
Thread T3 (remotefontconfi) created by T0 here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0xef3dbb in RemoteJSONPoll::start() builddir/online/wsd/COOLWSD.cpp:1104:9
    #4 0xe9c767 in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4471:33
    #5 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #6 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #7 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #8 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #9 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #10 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5aad074ffa06408ff7055046a5ba6d8674aec31d
(cherry picked from commit ce908e9)
mmeeks pushed a commit that referenced this pull request Oct 30, 2024
we lock this elsewhere when writing

READ of size 4 at 0x60300016be38 thread T7 (docbroker_001)
    #0 0x1ab5b94 in SocketPoll::wakeupWorld() builddir/online/net/Socket.cpp:764:16
    #1 0x14cc7e9 in DocumentBroker::DocumentBrokerPoll::pollingThread() builddir/online/wsd/DocumentBroker.cpp:153:9
    #2 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #3 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #4 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #5 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #6 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #7 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #8 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
    #9 0x7f0fddfd76e9 in start_thread (/lib64/libpthread.so.0+0xa6e9)
    #10 0x7f0fddcc149e in clone (/lib64/libc.so.6+0x11849e)
0x60300016be38 is located 24 bytes inside of 32-byte region [0x60300016be20,0x60300016be40)
freed by thread T3 (remotefontconfi) here:
    #0 0xac9a98 in operator delete(void*, unsigned long) llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_new_delete.cpp:172:3
    #1 0xbf49ad in std::__new_allocator<int>::deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/new_allocator.h:158:2
    #2 0xbf494d in std::allocator<int>::deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/allocator.h:200:25
    #3 0xbf494d in std::allocator_traits<std::allocator<int>>::deallocate(std::allocator<int>&, int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/alloc_traits.h:496:13
    #4 0xbf4874 in std::_Vector_base<int, std::allocator<int>>::_M_deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:387:4
    #5 0x19d624b in void std::vector<int, std::allocator<int>>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/vector.tcc:513:7
    #6 0x19b95bd in std::vector<int, std::allocator<int>>::push_back(int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1287:4
    #7 0x1a922fe in SocketPoll::createWakeups() builddir/online/net/Socket.cpp:857:23
    #8 0x1a90dd2 in SocketPoll::SocketPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>) builddir/online/net/Socket.cpp:336:5
    #9 0xf62703 in TerminatingPoll::TerminatingPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) builddir/online/./net/Socket.hpp:1046:9
    #10 0xf5e4fa in http::Session::syncRequest(http::Request const&) builddir/online/./net/HttpRequest.hpp:1284:25
    #11 0xf58d58 in RemoteJSONPoll::pollingThread() builddir/online/wsd/COOLWSD.cpp:1139:38
    #12 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #13 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #14 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #15 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #16 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #17 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #18 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
previously allocated by thread T0 here:
    #0 0xac8b98 in operator new(unsigned long) llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_new_delete.cpp:99:3
    #1 0xccfd04 in std::__new_allocator<int>::allocate(unsigned long, void const*) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/new_allocator.h:137:27
    #2 0xccfc31 in std::allocator<int>::allocate(unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/allocator.h:188:32
    #3 0xccfc31 in std::allocator_traits<std::allocator<int>>::allocate(std::allocator<int>&, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/alloc_traits.h:464:20
    #4 0xccf4ec in std::_Vector_base<int, std::allocator<int>>::_M_allocate(unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:378:20
    #5 0x19d5c65 in void std::vector<int, std::allocator<int>>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/vector.tcc:453:33
    #6 0x19b95bd in std::vector<int, std::allocator<int>>::push_back(int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1287:4
    #7 0x1a922fe in SocketPoll::createWakeups() builddir/online/net/Socket.cpp:857:23
    #8 0x1a90dd2 in SocketPoll::SocketPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>) builddir/online/net/Socket.cpp:336:5
    #9 0xf57119 in RemoteJSONPoll::RemoteJSONPoll(Poco::Util::LayeredConfiguration&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) builddir/online/wsd/COOLWSD.cpp:1071:11
    #10 0xef24ce in RemoteConfigPoll::RemoteConfigPoll(Poco::Util::LayeredConfiguration&) builddir/online/wsd/COOLWSD.cpp:1203:9
    #11 0xe94fef in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4351:22
    #12 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #13 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #14 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #15 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #16 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #17 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)
Thread T7 (docbroker_001) created by T5 (websrv_poll) here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0x1ab4f13 in SocketDisposition::execute() builddir/online/net/Socket.cpp:1060:22
    #4 0x1ab1525 in SocketPoll::poll(long) builddir/online/net/Socket.cpp:708:29
    #5 0xb668e2 in SocketPoll::poll(std::chrono::duration<long, std::ratio<1l, 1000000l>>) builddir/online/./net/Socket.hpp:777:61
    #6 0xf09d67 in SocketPoll::pollingThread() builddir/online/./net/Socket.hpp:950:13
    #7 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #8 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #9 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #10 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #11 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #12 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #13 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
Thread T5 (websrv_poll) created by T0 here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0xef5b24 in COOLWSDServer::start() builddir/online/wsd/COOLWSD.cpp:4033:24
    #4 0xe9d04c in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4483:13
    #5 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #6 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #7 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #8 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #9 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #10 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)
Thread T3 (remotefontconfi) created by T0 here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0xef3dbb in RemoteJSONPoll::start() builddir/online/wsd/COOLWSD.cpp:1104:9
    #4 0xe9c767 in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4471:33
    #5 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #6 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #7 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #8 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #9 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #10 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5aad074ffa06408ff7055046a5ba6d8674aec31d
(cherry picked from commit ce908e9)
timar pushed a commit that referenced this pull request Oct 30, 2024
we lock this elsewhere when writing

READ of size 4 at 0x60300016be38 thread T7 (docbroker_001)
    #0 0x1ab5b94 in SocketPoll::wakeupWorld() builddir/online/net/Socket.cpp:764:16
    #1 0x14cc7e9 in DocumentBroker::DocumentBrokerPoll::pollingThread() builddir/online/wsd/DocumentBroker.cpp:153:9
    #2 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #3 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #4 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #5 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #6 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #7 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #8 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
    #9 0x7f0fddfd76e9 in start_thread (/lib64/libpthread.so.0+0xa6e9)
    #10 0x7f0fddcc149e in clone (/lib64/libc.so.6+0x11849e)
0x60300016be38 is located 24 bytes inside of 32-byte region [0x60300016be20,0x60300016be40)
freed by thread T3 (remotefontconfi) here:
    #0 0xac9a98 in operator delete(void*, unsigned long) llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_new_delete.cpp:172:3
    #1 0xbf49ad in std::__new_allocator<int>::deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/new_allocator.h:158:2
    #2 0xbf494d in std::allocator<int>::deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/allocator.h:200:25
    #3 0xbf494d in std::allocator_traits<std::allocator<int>>::deallocate(std::allocator<int>&, int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/alloc_traits.h:496:13
    #4 0xbf4874 in std::_Vector_base<int, std::allocator<int>>::_M_deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:387:4
    #5 0x19d624b in void std::vector<int, std::allocator<int>>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/vector.tcc:513:7
    #6 0x19b95bd in std::vector<int, std::allocator<int>>::push_back(int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1287:4
    #7 0x1a922fe in SocketPoll::createWakeups() builddir/online/net/Socket.cpp:857:23
    #8 0x1a90dd2 in SocketPoll::SocketPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>) builddir/online/net/Socket.cpp:336:5
    #9 0xf62703 in TerminatingPoll::TerminatingPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) builddir/online/./net/Socket.hpp:1046:9
    #10 0xf5e4fa in http::Session::syncRequest(http::Request const&) builddir/online/./net/HttpRequest.hpp:1284:25
    #11 0xf58d58 in RemoteJSONPoll::pollingThread() builddir/online/wsd/COOLWSD.cpp:1139:38
    #12 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #13 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #14 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #15 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #16 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #17 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #18 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
previously allocated by thread T0 here:
    #0 0xac8b98 in operator new(unsigned long) llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_new_delete.cpp:99:3
    #1 0xccfd04 in std::__new_allocator<int>::allocate(unsigned long, void const*) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/new_allocator.h:137:27
    #2 0xccfc31 in std::allocator<int>::allocate(unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/allocator.h:188:32
    #3 0xccfc31 in std::allocator_traits<std::allocator<int>>::allocate(std::allocator<int>&, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/alloc_traits.h:464:20
    #4 0xccf4ec in std::_Vector_base<int, std::allocator<int>>::_M_allocate(unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:378:20
    #5 0x19d5c65 in void std::vector<int, std::allocator<int>>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/vector.tcc:453:33
    #6 0x19b95bd in std::vector<int, std::allocator<int>>::push_back(int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1287:4
    #7 0x1a922fe in SocketPoll::createWakeups() builddir/online/net/Socket.cpp:857:23
    #8 0x1a90dd2 in SocketPoll::SocketPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>) builddir/online/net/Socket.cpp:336:5
    #9 0xf57119 in RemoteJSONPoll::RemoteJSONPoll(Poco::Util::LayeredConfiguration&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) builddir/online/wsd/COOLWSD.cpp:1071:11
    #10 0xef24ce in RemoteConfigPoll::RemoteConfigPoll(Poco::Util::LayeredConfiguration&) builddir/online/wsd/COOLWSD.cpp:1203:9
    #11 0xe94fef in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4351:22
    #12 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #13 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #14 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #15 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #16 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #17 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)
Thread T7 (docbroker_001) created by T5 (websrv_poll) here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0x1ab4f13 in SocketDisposition::execute() builddir/online/net/Socket.cpp:1060:22
    #4 0x1ab1525 in SocketPoll::poll(long) builddir/online/net/Socket.cpp:708:29
    #5 0xb668e2 in SocketPoll::poll(std::chrono::duration<long, std::ratio<1l, 1000000l>>) builddir/online/./net/Socket.hpp:777:61
    #6 0xf09d67 in SocketPoll::pollingThread() builddir/online/./net/Socket.hpp:950:13
    #7 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #8 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #9 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #10 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #11 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #12 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #13 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
Thread T5 (websrv_poll) created by T0 here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0xef5b24 in COOLWSDServer::start() builddir/online/wsd/COOLWSD.cpp:4033:24
    #4 0xe9d04c in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4483:13
    #5 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #6 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #7 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #8 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #9 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #10 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)
Thread T3 (remotefontconfi) created by T0 here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0xef3dbb in RemoteJSONPoll::start() builddir/online/wsd/COOLWSD.cpp:1104:9
    #4 0xe9c767 in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4471:33
    #5 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #6 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #7 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #8 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #9 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #10 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5aad074ffa06408ff7055046a5ba6d8674aec31d
Minion3665 pushed a commit that referenced this pull request Nov 4, 2024
we lock this elsewhere when writing

READ of size 4 at 0x60300016be38 thread T7 (docbroker_001)
    #0 0x1ab5b94 in SocketPoll::wakeupWorld() builddir/online/net/Socket.cpp:764:16
    #1 0x14cc7e9 in DocumentBroker::DocumentBrokerPoll::pollingThread() builddir/online/wsd/DocumentBroker.cpp:153:9
    #2 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #3 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #4 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #5 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #6 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #7 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #8 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
    #9 0x7f0fddfd76e9 in start_thread (/lib64/libpthread.so.0+0xa6e9)
    #10 0x7f0fddcc149e in clone (/lib64/libc.so.6+0x11849e)
0x60300016be38 is located 24 bytes inside of 32-byte region [0x60300016be20,0x60300016be40)
freed by thread T3 (remotefontconfi) here:
    #0 0xac9a98 in operator delete(void*, unsigned long) llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_new_delete.cpp:172:3
    #1 0xbf49ad in std::__new_allocator<int>::deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/new_allocator.h:158:2
    #2 0xbf494d in std::allocator<int>::deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/allocator.h:200:25
    #3 0xbf494d in std::allocator_traits<std::allocator<int>>::deallocate(std::allocator<int>&, int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/alloc_traits.h:496:13
    #4 0xbf4874 in std::_Vector_base<int, std::allocator<int>>::_M_deallocate(int*, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:387:4
    #5 0x19d624b in void std::vector<int, std::allocator<int>>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/vector.tcc:513:7
    #6 0x19b95bd in std::vector<int, std::allocator<int>>::push_back(int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1287:4
    #7 0x1a922fe in SocketPoll::createWakeups() builddir/online/net/Socket.cpp:857:23
    #8 0x1a90dd2 in SocketPoll::SocketPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>) builddir/online/net/Socket.cpp:336:5
    #9 0xf62703 in TerminatingPoll::TerminatingPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) builddir/online/./net/Socket.hpp:1046:9
    #10 0xf5e4fa in http::Session::syncRequest(http::Request const&) builddir/online/./net/HttpRequest.hpp:1284:25
    #11 0xf58d58 in RemoteJSONPoll::pollingThread() builddir/online/wsd/COOLWSD.cpp:1139:38
    #12 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #13 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #14 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #15 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #16 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #17 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #18 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
previously allocated by thread T0 here:
    #0 0xac8b98 in operator new(unsigned long) llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_new_delete.cpp:99:3
    #1 0xccfd04 in std::__new_allocator<int>::allocate(unsigned long, void const*) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/new_allocator.h:137:27
    #2 0xccfc31 in std::allocator<int>::allocate(unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/allocator.h:188:32
    #3 0xccfc31 in std::allocator_traits<std::allocator<int>>::allocate(std::allocator<int>&, unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/alloc_traits.h:464:20
    #4 0xccf4ec in std::_Vector_base<int, std::allocator<int>>::_M_allocate(unsigned long) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:378:20
    #5 0x19d5c65 in void std::vector<int, std::allocator<int>>::_M_realloc_insert<int const&>(__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int>>>, int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/vector.tcc:453:33
    #6 0x19b95bd in std::vector<int, std::allocator<int>>::push_back(int const&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/stl_vector.h:1287:4
    #7 0x1a922fe in SocketPoll::createWakeups() builddir/online/net/Socket.cpp:857:23
    #8 0x1a90dd2 in SocketPoll::SocketPoll(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>) builddir/online/net/Socket.cpp:336:5
    #9 0xf57119 in RemoteJSONPoll::RemoteJSONPoll(Poco::Util::LayeredConfiguration&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) builddir/online/wsd/COOLWSD.cpp:1071:11
    #10 0xef24ce in RemoteConfigPoll::RemoteConfigPoll(Poco::Util::LayeredConfiguration&) builddir/online/wsd/COOLWSD.cpp:1203:9
    #11 0xe94fef in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4351:22
    #12 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #13 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #14 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #15 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #16 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #17 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)
Thread T7 (docbroker_001) created by T5 (websrv_poll) here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0x1ab4f13 in SocketDisposition::execute() builddir/online/net/Socket.cpp:1060:22
    #4 0x1ab1525 in SocketPoll::poll(long) builddir/online/net/Socket.cpp:708:29
    #5 0xb668e2 in SocketPoll::poll(std::chrono::duration<long, std::ratio<1l, 1000000l>>) builddir/online/./net/Socket.hpp:777:61
    #6 0xf09d67 in SocketPoll::pollingThread() builddir/online/./net/Socket.hpp:950:13
    #7 0x1a9beae in SocketPoll::pollingThreadEntry() builddir/online/net/Socket.cpp:477:9
    #8 0x1b6fb24 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:74:14
    #9 0x1b6f694 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/invoke.h:96:14
    #10 0x1b6f575 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:258:13
    #11 0x1b6f3af in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>::operator()() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:265:11
    #12 0x1b6ec62 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*>>>::_M_run() /opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/../../../../include/c++/12/bits/std_thread.h:210:13
    #13 0x7f0fde21bac2  (/usr/lib64/libstdc++.so.6+0xdcac2)
Thread T5 (websrv_poll) created by T0 here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0xef5b24 in COOLWSDServer::start() builddir/online/wsd/COOLWSD.cpp:4033:24
    #4 0xe9d04c in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4483:13
    #5 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #6 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #7 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #8 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #9 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #10 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)
Thread T3 (remotefontconfi) created by T0 here:
    #0 0xa10662 in __interceptor_pthread_create llvm-llvmorg-12.0.1.src/compiler-rt/lib/asan/asan_interceptors.cpp:205:3
    #1 0x7f0fde21be3b in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State>>, void (*)()) (/usr/lib64/libstdc++.so.6+0xdce3b)
    #2 0x1a97dee in SocketPoll::startThread() builddir/online/net/Socket.cpp:411:23
    #3 0xef3dbb in RemoteJSONPoll::start() builddir/online/wsd/COOLWSD.cpp:1104:9
    #4 0xe9c767 in COOLWSD::innerMain() builddir/online/wsd/COOLWSD.cpp:4471:33
    #5 0xea9736 in COOLWSD::main(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&) builddir/online/wsd/COOLWSD.cpp:4837:23
    #6 0x1bf84d6 in Poco::Util::Application::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/Application.cpp:362:12
    #7 0x1c0a125 in Poco::Util::ServerApplication::run() /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:95:25
    #8 0x1c0a25d in Poco::Util::ServerApplication::run(int, char**) /home/collabora/src/poco-1.12.5p2-all/Util/src/ServerApplication.cpp:585:12
    #9 0xeae5ce in main builddir/online/wsd/COOLWSD.cpp:5023:20
    #10 0x7f0fddbde24c in __libc_start_main (/lib64/libc.so.6+0x3524c)

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I5aad074ffa06408ff7055046a5ba6d8674aec31d
vmiklos added a commit that referenced this pull request Nov 5, 2024
`make -C cypress_test check-desktop spec=calc/annotation_spec.js`
sometimes failed due to coolwsd crashing in the background.

Checking with sanitizers, a memory corruption always happens on the
websrv_poll thread. First we call handleIncomingMessage() on a socket
handler:
    #13 0x5632a3dbf888 in StreamSocket::setHandler(std::shared_ptr<ProtocolHandlerInterface>) /home/vmiklos/git/collaboraonline/online-san/./net/Socket.hpp:1335:24
    #14 0x5632a3d6d44e in AdminSocketHandler::handleInitialRequest(std::weak_ptr<StreamSocket> const&, Poco::Net::HTTPRequest const&) /home/vmiklos/git/collaboraonline/online-san/wsd/Admin.cpp:499:17
    #15 0x5632a4291333 in ClientRequestDispatcher::handleIncomingMessage(SocketDisposition&) /home/vmiklos/git/collaboraonline/online-san/wsd/ClientRequestDispatcher.cpp:797:17
    #16 0x5632a4c9da3e in StreamSocket::handlePoll(SocketDisposition&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l>>>, int) /home/vmiklos/git/collaboraonline/online-san/./net/Socket.hpp:1501:33
Note how StreamSocket::handlePoll() invokes a member function of
_socketHandler, which calls back and resets _socketHandler. Then a
little bit later, still in
ClientRequestDispatcher::handleIncomingMessage() we try to continue
using `this`:
    #0 0x5632a3db1485 in ProtocolHandlerInterface::logPrefix(std::ostream&) const /home/vmiklos/git/collaboraonline/online-san/./net/Socket.hpp:517:66
    #1 0x5632a4298f32 in ClientRequestDispatcher::handleIncomingMessage(SocketDisposition&) /home/vmiklos/git/collaboraonline/online-san/wsd/ClientRequestDispatcher.cpp:969:9
    #2 0x5632a4c9da3e in StreamSocket::handlePoll(SocketDisposition&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l>>>, int) /home/vmiklos/git/collaboraonline/online-san/./net/Socket.hpp:1501:33
And that's a problem, since setHandler() already deleted the
ClientRequestDispatcher by that time.

Fix the problem by keeping the socket handler alive for the duration of
the handleIncomingMessage() call.

All tests in the `make -C cypress_test check-desktop
spec=calc/annotation_spec.js` suite passes with sanitizers after this.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I2360e71f7420ae96486c0a95fff77640c4bef29e
caolanm pushed a commit that referenced this pull request Nov 5, 2024
`make -C cypress_test check-desktop spec=calc/annotation_spec.js`
sometimes failed due to coolwsd crashing in the background.

Checking with sanitizers, a memory corruption always happens on the
websrv_poll thread. First we call handleIncomingMessage() on a socket
handler:
    #13 0x5632a3dbf888 in StreamSocket::setHandler(std::shared_ptr<ProtocolHandlerInterface>) /home/vmiklos/git/collaboraonline/online-san/./net/Socket.hpp:1335:24
    #14 0x5632a3d6d44e in AdminSocketHandler::handleInitialRequest(std::weak_ptr<StreamSocket> const&, Poco::Net::HTTPRequest const&) /home/vmiklos/git/collaboraonline/online-san/wsd/Admin.cpp:499:17
    #15 0x5632a4291333 in ClientRequestDispatcher::handleIncomingMessage(SocketDisposition&) /home/vmiklos/git/collaboraonline/online-san/wsd/ClientRequestDispatcher.cpp:797:17
    #16 0x5632a4c9da3e in StreamSocket::handlePoll(SocketDisposition&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l>>>, int) /home/vmiklos/git/collaboraonline/online-san/./net/Socket.hpp:1501:33
Note how StreamSocket::handlePoll() invokes a member function of
_socketHandler, which calls back and resets _socketHandler. Then a
little bit later, still in
ClientRequestDispatcher::handleIncomingMessage() we try to continue
using `this`:
    #0 0x5632a3db1485 in ProtocolHandlerInterface::logPrefix(std::ostream&) const /home/vmiklos/git/collaboraonline/online-san/./net/Socket.hpp:517:66
    #1 0x5632a4298f32 in ClientRequestDispatcher::handleIncomingMessage(SocketDisposition&) /home/vmiklos/git/collaboraonline/online-san/wsd/ClientRequestDispatcher.cpp:969:9
    #2 0x5632a4c9da3e in StreamSocket::handlePoll(SocketDisposition&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l>>>, int) /home/vmiklos/git/collaboraonline/online-san/./net/Socket.hpp:1501:33
And that's a problem, since setHandler() already deleted the
ClientRequestDispatcher by that time.

Fix the problem by keeping the socket handler alive for the duration of
the handleIncomingMessage() call.

All tests in the `make -C cypress_test check-desktop
spec=calc/annotation_spec.js` suite passes with sanitizers after this.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I2360e71f7420ae96486c0a95fff77640c4bef29e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant