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 '/android/app/src/main/res/values/strings.xml' in 'dsb' #18

Conversation

transifex-integration[bot]
Copy link
Contributor

The translations for the following file are now complete:

Parameter Value
Source file '/android/app/src/main/res/values/strings.xml'
Translation file 'android/app/src/main/res/values-dsb/strings.xml'
Language code 'dsb'
Transifex project slug collabora-office-on-android
Transifex resource slug android-app-src-main-res-values-strings-xml--master
Transifex event translation_completed

translation completed for the source file '/android/app/src/main/res/values/strings.xml'
on the 'dsb' 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_android-app-src-main-res-values-strings-xml--master_dsb branch October 1, 2020 12:12
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 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 Jun 21, 2022
In HttpRequestTests::test500GetStatuses, since we reused
the http::Session without removing from SocketPoll,
it is possible for the poll thread to access the
Session object while we create a new request, where
we replace its Response and Socket members.

To avoid that, we can try to remove the http::Session
instance from the SocketPoll. Alternatively, we
can create a new one for each request, which is
what we do here.

Below is the results of ASan, for the record.

==949494==ERROR: AddressSanitizer: heap-use-after-free on address 0x61700005afe0 at pc 0x55dc0c092c75 bp 0x7f8b539e5a10 sp 0x7f8b539e5a08
READ of size 4 at 0x61700005afe0 thread T10 (HttpAsyncReqPol)
    #0 0x55dc0c092c74 in http::Response::logPrefix(std::ostream&) const /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:835:66
    #1 0x55dc0c08f499 in http::Response::readData(char const*, long) /home/ash/prj/lo/online/test/../net/HttpRequest.cpp:641:5
    #2 0x55dc0c0998c9 in http::Session::handleIncomingMessage(SocketDisposition&) /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:1248:41
    #3 0x55dc0c0f0c3b in StreamSocket::handlePoll(SocketDisposition&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > >, int) /home/ash/prj/lo/online/test/../net/Socket.hpp:1339:33
    #4 0x55dc0c0b092d in SocketPoll::poll(long) /home/ash/prj/lo/online/test/../net/Socket.cpp:444:34
    #5 0x55dc0c10407c in SocketPoll::poll(std::chrono::duration<long, std::ratio<1l, 1000000l> >) /home/ash/prj/lo/online/test/../net/Socket.hpp:691:61
    #6 0x55dc0c10407c in SocketPoll::pollingThread() /home/ash/prj/lo/online/test/../net/Socket.hpp:648:13
    #7 0x55dc0c0ac445 in SocketPoll::pollingThreadEntry() /home/ash/prj/lo/online/test/../net/Socket.cpp:299:9
    #8 0x55dc0c12b6b9 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:73:14
    #9 0x55dc0c12b590 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14
    #10 0x55dc0c12b574 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:264:13
    #11 0x55dc0c12b463 in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*> >::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:271:11
    #12 0x55dc0c12b463 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*> > >::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:215:13
    #13 0x7f8b5a08cde3  (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xd6de3) (BuildId: c90e6603c7cdf84713cd445700a575d3ea446d9b)
    #14 0x7f8b59e4c608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8
    #15 0x7f8b59d44132 in __clone /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

0x61700005afe0 is located 736 bytes inside of 744-byte region [0x61700005ad00,0x61700005afe8)
freed by thread T0 here:
LLVMSymbolizer: error reading file: No such file or directory
    #0 0x55dc0bfe43dd in operator delete(void*) (/home/ash/prj/lo/online/test/unithttplib+0x20d3dd) (BuildId: 7954f6bea5efa6c39ca02e7033c014e826b9f5fd)
    #1 0x55dc0c1fe168 in std::_Sp_counted_ptr<http::Response*, (__gnu_cxx::_Lock_policy)2>::_M_dispose() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:380:9
    #2 0x55dc0c033768 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:158:6
    #3 0x55dc0c0335d5 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:733:11
    #4 0x55dc0c1f972c in std::__shared_ptr<http::Response, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:1183:31
    #5 0x55dc0c1f972c in std::enable_if<__sp_is_constructible<http::Response, http::Response>::value, void>::type std::__shared_ptr<http::Response, (__gnu_cxx::_Lock_policy)2>::reset<http::Response>(http::Response*) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:1309:4
    #6 0x55dc0c1f972c in http::Session::newRequest(http::Request) /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:1174:19
    #7 0x55dc0c1ee08b in http::Session::asyncRequest(http::Request const&, SocketPoll&) /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:1079:9
    #8 0x55dc0c1b718f in HttpRequestTests::test500GetStatuses() /home/ash/prj/lo/online/test/HttpRequestTests.cpp:515:9
    #9 0x55dc0c219ec9 in void std::__invoke_impl<void, void (HttpRequestTests::*&)(), HttpRequestTests*&>(std::__invoke_memfun_deref, void (HttpRequestTests::*&)(), HttpRequestTests*&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:73:14
    #10 0x55dc0c219de0 in std::__invoke_result<void (HttpRequestTests::*&)(), HttpRequestTests*&>::type std::__invoke<void (HttpRequestTests::*&)(), HttpRequestTests*&>(void (HttpRequestTests::*&)(), HttpRequestTests*&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14
    #11 0x55dc0c219dbc in void std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>::__call<void, 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/functional:416:11
    #12 0x55dc0c219d47 in void std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>::operator()<void>() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/functional:499:17
    #13 0x55dc0c219d47 in void std::__invoke_impl<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>(std::__invoke_other, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14
    #14 0x55dc0c219d47 in std::enable_if<is_invocable_r_v<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>, void>::type std::__invoke_r<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>(std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:110:2
    #15 0x55dc0c219a72 in std::_Function_handler<void (), std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()> >::_M_invoke(std::_Any_data const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:291:9
    #16 0x55dc0c09776b in std::function<void ()>::operator()() const /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:622:14
    #17 0x55dc0c219713 in CppUnit::TestCaller<HttpRequestTests>::runTest() /usr/include/cppunit/TestCaller.h:175:7
    #18 0x7f8b5ab23614 in CppUnit::TestCaseMethodFunctor::operator()() const (/usr/lib/x86_64-linux-gnu/libcppunit-1.15.so.1+0x24614) (BuildId: 4329d55843a6cf32b3e88d4d9aec95035315b163)
    #19 0x7ffdc354a41f  ([stack]+0x2b41f)

previously allocated by thread T0 here:
    #0 0x55dc0bfe3b7d in operator new(unsigned long) (/home/ash/prj/lo/online/test/unithttplib+0x20cb7d) (BuildId: 7954f6bea5efa6c39ca02e7033c014e826b9f5fd)
    #1 0x55dc0c1f969c in http::Session::newRequest(http::Request) /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:1174:25
    #2 0x55dc0c1ee08b in http::Session::asyncRequest(http::Request const&, SocketPoll&) /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:1079:9
    #3 0x55dc0c1b718f in HttpRequestTests::test500GetStatuses() /home/ash/prj/lo/online/test/HttpRequestTests.cpp:515:9
    #4 0x55dc0c219ec9 in void std::__invoke_impl<void, void (HttpRequestTests::*&)(), HttpRequestTests*&>(std::__invoke_memfun_deref, void (HttpRequestTests::*&)(), HttpRequestTests*&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:73:14
    #5 0x55dc0c219de0 in std::__invoke_result<void (HttpRequestTests::*&)(), HttpRequestTests*&>::type std::__invoke<void (HttpRequestTests::*&)(), HttpRequestTests*&>(void (HttpRequestTests::*&)(), HttpRequestTests*&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14
    #6 0x55dc0c219dbc in void std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>::__call<void, 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/functional:416:11
    #7 0x55dc0c219d47 in void std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>::operator()<void>() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/functional:499:17
    #8 0x55dc0c219d47 in void std::__invoke_impl<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>(std::__invoke_other, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14
    #9 0x55dc0c219d47 in std::enable_if<is_invocable_r_v<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>, void>::type std::__invoke_r<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>(std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:110:2
    #10 0x55dc0c219a72 in std::_Function_handler<void (), std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()> >::_M_invoke(std::_Any_data const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:291:9
    #11 0x55dc0c09776b in std::function<void ()>::operator()() const /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:622:14
    #12 0x55dc0c219713 in CppUnit::TestCaller<HttpRequestTests>::runTest() /usr/include/cppunit/TestCaller.h:175:7
    #13 0x7f8b5ab23614 in CppUnit::TestCaseMethodFunctor::operator()() const (/usr/lib/x86_64-linux-gnu/libcppunit-1.15.so.1+0x24614) (BuildId: 4329d55843a6cf32b3e88d4d9aec95035315b163)
    #14 0x7ffdc354a41f  ([stack]+0x2b41f)

Thread T10 (HttpAsyncReqPol) created by T0 here:
    #0 0x55dc0bf922bc in __interceptor_pthread_create (/home/ash/prj/lo/online/test/unithttplib+0x1bb2bc) (BuildId: 7954f6bea5efa6c39ca02e7033c014e826b9f5fd)
    #1 0x7f8b5a08d0a8 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xd70a8) (BuildId: c90e6603c7cdf84713cd445700a575d3ea446d9b)
    #2 0x55dc0c0aa467 in SocketPoll::startThread() /home/ash/prj/lo/online/test/../net/Socket.cpp:238:23
    #3 0x55dc0c1b57b3 in HttpRequestTests::test500GetStatuses() /home/ash/prj/lo/online/test/HttpRequestTests.cpp:482:16
    #4 0x55dc0c219ec9 in void std::__invoke_impl<void, void (HttpRequestTests::*&)(), HttpRequestTests*&>(std::__invoke_memfun_deref, void (HttpRequestTests::*&)(), HttpRequestTests*&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:73:14
    #5 0x55dc0c219de0 in std::__invoke_result<void (HttpRequestTests::*&)(), HttpRequestTests*&>::type std::__invoke<void (HttpRequestTests::*&)(), HttpRequestTests*&>(void (HttpRequestTests::*&)(), HttpRequestTests*&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14
    #6 0x55dc0c219dbc in void std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>::__call<void, 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/functional:416:11
    #7 0x55dc0c219d47 in void std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>::operator()<void>() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/functional:499:17
    #8 0x55dc0c219d47 in void std::__invoke_impl<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>(std::__invoke_other, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14
    #9 0x55dc0c219d47 in std::enable_if<is_invocable_r_v<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>, void>::type std::__invoke_r<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>(std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:110:2
    #10 0x55dc0c219a72 in std::_Function_handler<void (), std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()> >::_M_invoke(std::_Any_data const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:291:9
    #11 0x55dc0c09776b in std::function<void ()>::operator()() const /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:622:14
    #12 0x55dc0c219713 in CppUnit::TestCaller<HttpRequestTests>::runTest() /usr/include/cppunit/TestCaller.h:175:7
    #13 0x7f8b5ab23614 in CppUnit::TestCaseMethodFunctor::operator()() const (/usr/lib/x86_64-linux-gnu/libcppunit-1.15.so.1+0x24614) (BuildId: 4329d55843a6cf32b3e88d4d9aec95035315b163)
    #14 0x7ffdc354a41f  ([stack]+0x2b41f)

SUMMARY: AddressSanitizer: heap-use-after-free /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:835:66 in http::Response::logPrefix(std::ostream&) const
Shadow bytes around the buggy address:
  0x0c2e800035a0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e800035b0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e800035c0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e800035d0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e800035e0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0c2e800035f0: fd fd fd fd fd fd fd fd fd fd fd fd[fd]fa fa fa
  0x0c2e80003600: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e80003610: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e80003620: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e80003630: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e80003640: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==949494==ABORTING

Change-Id: I5e1539c3adbab9b5027d84cc1dbab4b90271c458
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Ashod added a commit that referenced this pull request Jun 22, 2022
In HttpRequestTests::test500GetStatuses, since we reused
the http::Session without removing from SocketPoll,
it is possible for the poll thread to access the
Session object while we create a new request, where
we replace its Response and Socket members.

To avoid that, we can try to remove the http::Session
instance from the SocketPoll. Alternatively, we
can create a new one for each request, which is
what we do here.

Below is the results of ASan, for the record.

==949494==ERROR: AddressSanitizer: heap-use-after-free on address 0x61700005afe0 at pc 0x55dc0c092c75 bp 0x7f8b539e5a10 sp 0x7f8b539e5a08
READ of size 4 at 0x61700005afe0 thread T10 (HttpAsyncReqPol)
    #0 0x55dc0c092c74 in http::Response::logPrefix(std::ostream&) const /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:835:66
    #1 0x55dc0c08f499 in http::Response::readData(char const*, long) /home/ash/prj/lo/online/test/../net/HttpRequest.cpp:641:5
    #2 0x55dc0c0998c9 in http::Session::handleIncomingMessage(SocketDisposition&) /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:1248:41
    #3 0x55dc0c0f0c3b in StreamSocket::handlePoll(SocketDisposition&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > >, int) /home/ash/prj/lo/online/test/../net/Socket.hpp:1339:33
    #4 0x55dc0c0b092d in SocketPoll::poll(long) /home/ash/prj/lo/online/test/../net/Socket.cpp:444:34
    #5 0x55dc0c10407c in SocketPoll::poll(std::chrono::duration<long, std::ratio<1l, 1000000l> >) /home/ash/prj/lo/online/test/../net/Socket.hpp:691:61
    #6 0x55dc0c10407c in SocketPoll::pollingThread() /home/ash/prj/lo/online/test/../net/Socket.hpp:648:13
    #7 0x55dc0c0ac445 in SocketPoll::pollingThreadEntry() /home/ash/prj/lo/online/test/../net/Socket.cpp:299:9
    #8 0x55dc0c12b6b9 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:73:14
    #9 0x55dc0c12b590 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14
    #10 0x55dc0c12b574 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:264:13
    #11 0x55dc0c12b463 in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*> >::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:271:11
    #12 0x55dc0c12b463 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*> > >::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:215:13
    #13 0x7f8b5a08cde3  (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xd6de3) (BuildId: c90e6603c7cdf84713cd445700a575d3ea446d9b)
    #14 0x7f8b59e4c608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8
    #15 0x7f8b59d44132 in __clone /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

0x61700005afe0 is located 736 bytes inside of 744-byte region [0x61700005ad00,0x61700005afe8)
freed by thread T0 here:
LLVMSymbolizer: error reading file: No such file or directory
    #0 0x55dc0bfe43dd in operator delete(void*) (/home/ash/prj/lo/online/test/unithttplib+0x20d3dd) (BuildId: 7954f6bea5efa6c39ca02e7033c014e826b9f5fd)
    #1 0x55dc0c1fe168 in std::_Sp_counted_ptr<http::Response*, (__gnu_cxx::_Lock_policy)2>::_M_dispose() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:380:9
    #2 0x55dc0c033768 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:158:6
    #3 0x55dc0c0335d5 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:733:11
    #4 0x55dc0c1f972c in std::__shared_ptr<http::Response, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:1183:31
    #5 0x55dc0c1f972c in std::enable_if<__sp_is_constructible<http::Response, http::Response>::value, void>::type std::__shared_ptr<http::Response, (__gnu_cxx::_Lock_policy)2>::reset<http::Response>(http::Response*) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:1309:4
    #6 0x55dc0c1f972c in http::Session::newRequest(http::Request) /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:1174:19
    #7 0x55dc0c1ee08b in http::Session::asyncRequest(http::Request const&, SocketPoll&) /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:1079:9
    #8 0x55dc0c1b718f in HttpRequestTests::test500GetStatuses() /home/ash/prj/lo/online/test/HttpRequestTests.cpp:515:9
    #9 0x55dc0c219ec9 in void std::__invoke_impl<void, void (HttpRequestTests::*&)(), HttpRequestTests*&>(std::__invoke_memfun_deref, void (HttpRequestTests::*&)(), HttpRequestTests*&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:73:14
    #10 0x55dc0c219de0 in std::__invoke_result<void (HttpRequestTests::*&)(), HttpRequestTests*&>::type std::__invoke<void (HttpRequestTests::*&)(), HttpRequestTests*&>(void (HttpRequestTests::*&)(), HttpRequestTests*&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14
    #11 0x55dc0c219dbc in void std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>::__call<void, 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/functional:416:11
    #12 0x55dc0c219d47 in void std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>::operator()<void>() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/functional:499:17
    #13 0x55dc0c219d47 in void std::__invoke_impl<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>(std::__invoke_other, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14
    #14 0x55dc0c219d47 in std::enable_if<is_invocable_r_v<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>, void>::type std::__invoke_r<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>(std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:110:2
    #15 0x55dc0c219a72 in std::_Function_handler<void (), std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()> >::_M_invoke(std::_Any_data const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:291:9
    #16 0x55dc0c09776b in std::function<void ()>::operator()() const /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:622:14
    #17 0x55dc0c219713 in CppUnit::TestCaller<HttpRequestTests>::runTest() /usr/include/cppunit/TestCaller.h:175:7
    #18 0x7f8b5ab23614 in CppUnit::TestCaseMethodFunctor::operator()() const (/usr/lib/x86_64-linux-gnu/libcppunit-1.15.so.1+0x24614) (BuildId: 4329d55843a6cf32b3e88d4d9aec95035315b163)
    #19 0x7ffdc354a41f  ([stack]+0x2b41f)

previously allocated by thread T0 here:
    #0 0x55dc0bfe3b7d in operator new(unsigned long) (/home/ash/prj/lo/online/test/unithttplib+0x20cb7d) (BuildId: 7954f6bea5efa6c39ca02e7033c014e826b9f5fd)
    #1 0x55dc0c1f969c in http::Session::newRequest(http::Request) /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:1174:25
    #2 0x55dc0c1ee08b in http::Session::asyncRequest(http::Request const&, SocketPoll&) /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:1079:9
    #3 0x55dc0c1b718f in HttpRequestTests::test500GetStatuses() /home/ash/prj/lo/online/test/HttpRequestTests.cpp:515:9
    #4 0x55dc0c219ec9 in void std::__invoke_impl<void, void (HttpRequestTests::*&)(), HttpRequestTests*&>(std::__invoke_memfun_deref, void (HttpRequestTests::*&)(), HttpRequestTests*&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:73:14
    #5 0x55dc0c219de0 in std::__invoke_result<void (HttpRequestTests::*&)(), HttpRequestTests*&>::type std::__invoke<void (HttpRequestTests::*&)(), HttpRequestTests*&>(void (HttpRequestTests::*&)(), HttpRequestTests*&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14
    #6 0x55dc0c219dbc in void std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>::__call<void, 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/functional:416:11
    #7 0x55dc0c219d47 in void std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>::operator()<void>() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/functional:499:17
    #8 0x55dc0c219d47 in void std::__invoke_impl<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>(std::__invoke_other, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14
    #9 0x55dc0c219d47 in std::enable_if<is_invocable_r_v<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>, void>::type std::__invoke_r<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>(std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:110:2
    #10 0x55dc0c219a72 in std::_Function_handler<void (), std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()> >::_M_invoke(std::_Any_data const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:291:9
    #11 0x55dc0c09776b in std::function<void ()>::operator()() const /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:622:14
    #12 0x55dc0c219713 in CppUnit::TestCaller<HttpRequestTests>::runTest() /usr/include/cppunit/TestCaller.h:175:7
    #13 0x7f8b5ab23614 in CppUnit::TestCaseMethodFunctor::operator()() const (/usr/lib/x86_64-linux-gnu/libcppunit-1.15.so.1+0x24614) (BuildId: 4329d55843a6cf32b3e88d4d9aec95035315b163)
    #14 0x7ffdc354a41f  ([stack]+0x2b41f)

Thread T10 (HttpAsyncReqPol) created by T0 here:
    #0 0x55dc0bf922bc in __interceptor_pthread_create (/home/ash/prj/lo/online/test/unithttplib+0x1bb2bc) (BuildId: 7954f6bea5efa6c39ca02e7033c014e826b9f5fd)
    #1 0x7f8b5a08d0a8 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xd70a8) (BuildId: c90e6603c7cdf84713cd445700a575d3ea446d9b)
    #2 0x55dc0c0aa467 in SocketPoll::startThread() /home/ash/prj/lo/online/test/../net/Socket.cpp:238:23
    #3 0x55dc0c1b57b3 in HttpRequestTests::test500GetStatuses() /home/ash/prj/lo/online/test/HttpRequestTests.cpp:482:16
    #4 0x55dc0c219ec9 in void std::__invoke_impl<void, void (HttpRequestTests::*&)(), HttpRequestTests*&>(std::__invoke_memfun_deref, void (HttpRequestTests::*&)(), HttpRequestTests*&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:73:14
    #5 0x55dc0c219de0 in std::__invoke_result<void (HttpRequestTests::*&)(), HttpRequestTests*&>::type std::__invoke<void (HttpRequestTests::*&)(), HttpRequestTests*&>(void (HttpRequestTests::*&)(), HttpRequestTests*&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14
    #6 0x55dc0c219dbc in void std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>::__call<void, 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/functional:416:11
    #7 0x55dc0c219d47 in void std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>::operator()<void>() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/functional:499:17
    #8 0x55dc0c219d47 in void std::__invoke_impl<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>(std::__invoke_other, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14
    #9 0x55dc0c219d47 in std::enable_if<is_invocable_r_v<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>, void>::type std::__invoke_r<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>(std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:110:2
    #10 0x55dc0c219a72 in std::_Function_handler<void (), std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()> >::_M_invoke(std::_Any_data const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:291:9
    #11 0x55dc0c09776b in std::function<void ()>::operator()() const /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:622:14
    #12 0x55dc0c219713 in CppUnit::TestCaller<HttpRequestTests>::runTest() /usr/include/cppunit/TestCaller.h:175:7
    #13 0x7f8b5ab23614 in CppUnit::TestCaseMethodFunctor::operator()() const (/usr/lib/x86_64-linux-gnu/libcppunit-1.15.so.1+0x24614) (BuildId: 4329d55843a6cf32b3e88d4d9aec95035315b163)
    #14 0x7ffdc354a41f  ([stack]+0x2b41f)

SUMMARY: AddressSanitizer: heap-use-after-free /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:835:66 in http::Response::logPrefix(std::ostream&) const
Shadow bytes around the buggy address:
  0x0c2e800035a0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e800035b0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e800035c0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e800035d0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e800035e0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0c2e800035f0: fd fd fd fd fd fd fd fd fd fd fd fd[fd]fa fa fa
  0x0c2e80003600: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e80003610: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e80003620: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e80003630: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e80003640: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==949494==ABORTING

Change-Id: I5e1539c3adbab9b5027d84cc1dbab4b90271c458
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
vmiklos pushed a commit that referenced this pull request Jun 24, 2022
In HttpRequestTests::test500GetStatuses, since we reused
the http::Session without removing from SocketPoll,
it is possible for the poll thread to access the
Session object while we create a new request, where
we replace its Response and Socket members.

To avoid that, we can try to remove the http::Session
instance from the SocketPoll. Alternatively, we
can create a new one for each request, which is
what we do here.

Below is the results of ASan, for the record.

==949494==ERROR: AddressSanitizer: heap-use-after-free on address 0x61700005afe0 at pc 0x55dc0c092c75 bp 0x7f8b539e5a10 sp 0x7f8b539e5a08
READ of size 4 at 0x61700005afe0 thread T10 (HttpAsyncReqPol)
    #0 0x55dc0c092c74 in http::Response::logPrefix(std::ostream&) const /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:835:66
    #1 0x55dc0c08f499 in http::Response::readData(char const*, long) /home/ash/prj/lo/online/test/../net/HttpRequest.cpp:641:5
    #2 0x55dc0c0998c9 in http::Session::handleIncomingMessage(SocketDisposition&) /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:1248:41
    #3 0x55dc0c0f0c3b in StreamSocket::handlePoll(SocketDisposition&, std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long, std::ratio<1l, 1000000000l> > >, int) /home/ash/prj/lo/online/test/../net/Socket.hpp:1339:33
    #4 0x55dc0c0b092d in SocketPoll::poll(long) /home/ash/prj/lo/online/test/../net/Socket.cpp:444:34
    #5 0x55dc0c10407c in SocketPoll::poll(std::chrono::duration<long, std::ratio<1l, 1000000l> >) /home/ash/prj/lo/online/test/../net/Socket.hpp:691:61
    #6 0x55dc0c10407c in SocketPoll::pollingThread() /home/ash/prj/lo/online/test/../net/Socket.hpp:648:13
    #7 0x55dc0c0ac445 in SocketPoll::pollingThreadEntry() /home/ash/prj/lo/online/test/../net/Socket.cpp:299:9
    #8 0x55dc0c12b6b9 in void std::__invoke_impl<void, void (SocketPoll::*)(), SocketPoll*>(std::__invoke_memfun_deref, void (SocketPoll::*&&)(), SocketPoll*&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:73:14
    #9 0x55dc0c12b590 in std::__invoke_result<void (SocketPoll::*)(), SocketPoll*>::type std::__invoke<void (SocketPoll::*)(), SocketPoll*>(void (SocketPoll::*&&)(), SocketPoll*&&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14
    #10 0x55dc0c12b574 in void std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:264:13
    #11 0x55dc0c12b463 in std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*> >::operator()() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:271:11
    #12 0x55dc0c12b463 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (SocketPoll::*)(), SocketPoll*> > >::_M_run() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/thread:215:13
    #13 0x7f8b5a08cde3  (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xd6de3) (BuildId: c90e6603c7cdf84713cd445700a575d3ea446d9b)
    #14 0x7f8b59e4c608 in start_thread /build/glibc-SzIz7B/glibc-2.31/nptl/pthread_create.c:477:8
    #15 0x7f8b59d44132 in __clone /build/glibc-SzIz7B/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

0x61700005afe0 is located 736 bytes inside of 744-byte region [0x61700005ad00,0x61700005afe8)
freed by thread T0 here:
LLVMSymbolizer: error reading file: No such file or directory
    #0 0x55dc0bfe43dd in operator delete(void*) (/home/ash/prj/lo/online/test/unithttplib+0x20d3dd) (BuildId: 7954f6bea5efa6c39ca02e7033c014e826b9f5fd)
    #1 0x55dc0c1fe168 in std::_Sp_counted_ptr<http::Response*, (__gnu_cxx::_Lock_policy)2>::_M_dispose() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:380:9
    #2 0x55dc0c033768 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:158:6
    #3 0x55dc0c0335d5 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:733:11
    #4 0x55dc0c1f972c in std::__shared_ptr<http::Response, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:1183:31
    #5 0x55dc0c1f972c in std::enable_if<__sp_is_constructible<http::Response, http::Response>::value, void>::type std::__shared_ptr<http::Response, (__gnu_cxx::_Lock_policy)2>::reset<http::Response>(http::Response*) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/shared_ptr_base.h:1309:4
    #6 0x55dc0c1f972c in http::Session::newRequest(http::Request) /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:1174:19
    #7 0x55dc0c1ee08b in http::Session::asyncRequest(http::Request const&, SocketPoll&) /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:1079:9
    #8 0x55dc0c1b718f in HttpRequestTests::test500GetStatuses() /home/ash/prj/lo/online/test/HttpRequestTests.cpp:515:9
    #9 0x55dc0c219ec9 in void std::__invoke_impl<void, void (HttpRequestTests::*&)(), HttpRequestTests*&>(std::__invoke_memfun_deref, void (HttpRequestTests::*&)(), HttpRequestTests*&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:73:14
    #10 0x55dc0c219de0 in std::__invoke_result<void (HttpRequestTests::*&)(), HttpRequestTests*&>::type std::__invoke<void (HttpRequestTests::*&)(), HttpRequestTests*&>(void (HttpRequestTests::*&)(), HttpRequestTests*&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14
    #11 0x55dc0c219dbc in void std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>::__call<void, 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/functional:416:11
    #12 0x55dc0c219d47 in void std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>::operator()<void>() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/functional:499:17
    #13 0x55dc0c219d47 in void std::__invoke_impl<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>(std::__invoke_other, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14
    #14 0x55dc0c219d47 in std::enable_if<is_invocable_r_v<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>, void>::type std::__invoke_r<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>(std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:110:2
    #15 0x55dc0c219a72 in std::_Function_handler<void (), std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()> >::_M_invoke(std::_Any_data const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:291:9
    #16 0x55dc0c09776b in std::function<void ()>::operator()() const /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:622:14
    #17 0x55dc0c219713 in CppUnit::TestCaller<HttpRequestTests>::runTest() /usr/include/cppunit/TestCaller.h:175:7
    #18 0x7f8b5ab23614 in CppUnit::TestCaseMethodFunctor::operator()() const (/usr/lib/x86_64-linux-gnu/libcppunit-1.15.so.1+0x24614) (BuildId: 4329d55843a6cf32b3e88d4d9aec95035315b163)
    #19 0x7ffdc354a41f  ([stack]+0x2b41f)

previously allocated by thread T0 here:
    #0 0x55dc0bfe3b7d in operator new(unsigned long) (/home/ash/prj/lo/online/test/unithttplib+0x20cb7d) (BuildId: 7954f6bea5efa6c39ca02e7033c014e826b9f5fd)
    #1 0x55dc0c1f969c in http::Session::newRequest(http::Request) /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:1174:25
    #2 0x55dc0c1ee08b in http::Session::asyncRequest(http::Request const&, SocketPoll&) /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:1079:9
    #3 0x55dc0c1b718f in HttpRequestTests::test500GetStatuses() /home/ash/prj/lo/online/test/HttpRequestTests.cpp:515:9
    #4 0x55dc0c219ec9 in void std::__invoke_impl<void, void (HttpRequestTests::*&)(), HttpRequestTests*&>(std::__invoke_memfun_deref, void (HttpRequestTests::*&)(), HttpRequestTests*&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:73:14
    #5 0x55dc0c219de0 in std::__invoke_result<void (HttpRequestTests::*&)(), HttpRequestTests*&>::type std::__invoke<void (HttpRequestTests::*&)(), HttpRequestTests*&>(void (HttpRequestTests::*&)(), HttpRequestTests*&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14
    #6 0x55dc0c219dbc in void std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>::__call<void, 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/functional:416:11
    #7 0x55dc0c219d47 in void std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>::operator()<void>() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/functional:499:17
    #8 0x55dc0c219d47 in void std::__invoke_impl<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>(std::__invoke_other, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14
    #9 0x55dc0c219d47 in std::enable_if<is_invocable_r_v<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>, void>::type std::__invoke_r<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>(std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:110:2
    #10 0x55dc0c219a72 in std::_Function_handler<void (), std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()> >::_M_invoke(std::_Any_data const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:291:9
    #11 0x55dc0c09776b in std::function<void ()>::operator()() const /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:622:14
    #12 0x55dc0c219713 in CppUnit::TestCaller<HttpRequestTests>::runTest() /usr/include/cppunit/TestCaller.h:175:7
    #13 0x7f8b5ab23614 in CppUnit::TestCaseMethodFunctor::operator()() const (/usr/lib/x86_64-linux-gnu/libcppunit-1.15.so.1+0x24614) (BuildId: 4329d55843a6cf32b3e88d4d9aec95035315b163)
    #14 0x7ffdc354a41f  ([stack]+0x2b41f)

Thread T10 (HttpAsyncReqPol) created by T0 here:
    #0 0x55dc0bf922bc in __interceptor_pthread_create (/home/ash/prj/lo/online/test/unithttplib+0x1bb2bc) (BuildId: 7954f6bea5efa6c39ca02e7033c014e826b9f5fd)
    #1 0x7f8b5a08d0a8 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xd70a8) (BuildId: c90e6603c7cdf84713cd445700a575d3ea446d9b)
    #2 0x55dc0c0aa467 in SocketPoll::startThread() /home/ash/prj/lo/online/test/../net/Socket.cpp:238:23
    #3 0x55dc0c1b57b3 in HttpRequestTests::test500GetStatuses() /home/ash/prj/lo/online/test/HttpRequestTests.cpp:482:16
    #4 0x55dc0c219ec9 in void std::__invoke_impl<void, void (HttpRequestTests::*&)(), HttpRequestTests*&>(std::__invoke_memfun_deref, void (HttpRequestTests::*&)(), HttpRequestTests*&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:73:14
    #5 0x55dc0c219de0 in std::__invoke_result<void (HttpRequestTests::*&)(), HttpRequestTests*&>::type std::__invoke<void (HttpRequestTests::*&)(), HttpRequestTests*&>(void (HttpRequestTests::*&)(), HttpRequestTests*&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:95:14
    #6 0x55dc0c219dbc in void std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>::__call<void, 0ul>(std::tuple<>&&, std::_Index_tuple<0ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/functional:416:11
    #7 0x55dc0c219d47 in void std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>::operator()<void>() /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/functional:499:17
    #8 0x55dc0c219d47 in void std::__invoke_impl<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>(std::__invoke_other, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:60:14
    #9 0x55dc0c219d47 in std::enable_if<is_invocable_r_v<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>, void>::type std::__invoke_r<void, std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&>(std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/invoke.h:110:2
    #10 0x55dc0c219a72 in std::_Function_handler<void (), std::_Bind<void (HttpRequestTests::* (HttpRequestTests*))()> >::_M_invoke(std::_Any_data const&) /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:291:9
    #11 0x55dc0c09776b in std::function<void ()>::operator()() const /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/std_function.h:622:14
    #12 0x55dc0c219713 in CppUnit::TestCaller<HttpRequestTests>::runTest() /usr/include/cppunit/TestCaller.h:175:7
    #13 0x7f8b5ab23614 in CppUnit::TestCaseMethodFunctor::operator()() const (/usr/lib/x86_64-linux-gnu/libcppunit-1.15.so.1+0x24614) (BuildId: 4329d55843a6cf32b3e88d4d9aec95035315b163)
    #14 0x7ffdc354a41f  ([stack]+0x2b41f)

SUMMARY: AddressSanitizer: heap-use-after-free /home/ash/prj/lo/online/test/../net/HttpRequest.hpp:835:66 in http::Response::logPrefix(std::ostream&) const
Shadow bytes around the buggy address:
  0x0c2e800035a0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e800035b0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e800035c0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e800035d0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e800035e0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0c2e800035f0: fd fd fd fd fd fd fd fd fd fd fd fd[fd]fa fa fa
  0x0c2e80003600: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e80003610: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e80003620: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e80003630: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e80003640: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==949494==ABORTING

Change-Id: I5e1539c3adbab9b5027d84cc1dbab4b90271c458
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
@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
caolanm added a commit that referenced this pull request Nov 12, 2024
otherwise unpleasant crashy things can happen

 #8  0x00007f7fbce37902 in abort () from /lib64/libc.so.6
 #9  0x00007f7fbdab0801 in Poco::SignalHandler::handleSignal(int) [clone .cold] () from /lib64/libPocoFoundation.so.103
 #10 <signal handler called>
 #11 0x00000000006ea6a8 in DocBasicInfo::getIdleTime (this=0x7f7f80020fe0) at wsd/AdminModel.hpp:148
 #12 0x0000000000714a6f in operator() (__closure=0x7f7f9cbeec67, a=..., b=...) at wsd/AdminModel.cpp:754
 ...
 #18 0x0000000000719f75 in std::sort<__gnu_cxx::__normal_iterator<DocBasicInfo*, std::vector<DocBasicInfo> >, AdminModel::getDocumentsSortedByIdle()
 #19 0x0000000000715079 in AdminModel::getDocumentsSortedByIdle (this=0xb7c988 <Admin::instance()::admin+264>) at wsd/AdminModel.cpp:751

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I7fee4067c9af6be345be2c85262a78ca2e264758
timar pushed a commit that referenced this pull request Nov 12, 2024
otherwise unpleasant crashy things can happen

 #8  0x00007f7fbce37902 in abort () from /lib64/libc.so.6
 #9  0x00007f7fbdab0801 in Poco::SignalHandler::handleSignal(int) [clone .cold] () from /lib64/libPocoFoundation.so.103
 #10 <signal handler called>
 #11 0x00000000006ea6a8 in DocBasicInfo::getIdleTime (this=0x7f7f80020fe0) at wsd/AdminModel.hpp:148
 #12 0x0000000000714a6f in operator() (__closure=0x7f7f9cbeec67, a=..., b=...) at wsd/AdminModel.cpp:754
 ...
 #18 0x0000000000719f75 in std::sort<__gnu_cxx::__normal_iterator<DocBasicInfo*, std::vector<DocBasicInfo> >, AdminModel::getDocumentsSortedByIdle()
 #19 0x0000000000715079 in AdminModel::getDocumentsSortedByIdle (this=0xb7c988 <Admin::instance()::admin+264>) at wsd/AdminModel.cpp:751

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I7fee4067c9af6be345be2c85262a78ca2e264758
timar pushed a commit that referenced this pull request Nov 12, 2024
otherwise unpleasant crashy things can happen

 #8  0x00007f7fbce37902 in abort () from /lib64/libc.so.6
 #9  0x00007f7fbdab0801 in Poco::SignalHandler::handleSignal(int) [clone .cold] () from /lib64/libPocoFoundation.so.103
 #10 <signal handler called>
 #11 0x00000000006ea6a8 in DocBasicInfo::getIdleTime (this=0x7f7f80020fe0) at wsd/AdminModel.hpp:148
 #12 0x0000000000714a6f in operator() (__closure=0x7f7f9cbeec67, a=..., b=...) at wsd/AdminModel.cpp:754
 ...
 #18 0x0000000000719f75 in std::sort<__gnu_cxx::__normal_iterator<DocBasicInfo*, std::vector<DocBasicInfo> >, AdminModel::getDocumentsSortedByIdle()
 #19 0x0000000000715079 in AdminModel::getDocumentsSortedByIdle (this=0xb7c988 <Admin::instance()::admin+264>) at wsd/AdminModel.cpp:751

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I7fee4067c9af6be345be2c85262a78ca2e264758
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