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

fix license headers #1

Merged
merged 1 commit into from
Oct 1, 2020
Merged

fix license headers #1

merged 1 commit into from
Oct 1, 2020

Conversation

timar
Copy link
Member

@timar timar commented Oct 1, 2020

No description provided.

@timar timar requested a review from mmeeks October 1, 2020 05:56
@yunusem yunusem closed this Oct 1, 2020
@yunusem yunusem reopened this Oct 1, 2020
@yunusem yunusem added re-trigger-ci Use this when you need to re-trigger CI without rebase and removed re-trigger-ci Use this when you need to re-trigger CI without rebase labels Oct 1, 2020
@yunusem yunusem closed this Oct 1, 2020
@yunusem yunusem reopened this Oct 1, 2020
Change-Id: I8623770b32d278a45357dc7f757fabfadd2b4af7
@timar timar force-pushed the timar/licenseheader branch from 58e4351 to a5b850a Compare October 1, 2020 07:16
@timar timar merged commit 0002fdf into master Oct 1, 2020
@timar timar deleted the timar/licenseheader branch October 1, 2020 09:56
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)
vmiklos added a commit that referenced this pull request Jun 20, 2024
The failure was:

	==79463== ERROR: libFuzzer: out-of-memory (used: 2053Mb; limit: 2048Mb)
	392260464 byte(s) (45%) in 5448062 allocation(s)
	    #0 0x5648cd721266 in operator new(unsigned long) /home/abuild/rpmbuild/BUILD/llvm-15.0.7.src/build/../projects/compiler-rt/lib/asan/asan_new_delete.cpp:95:3
	    #1 0x7f8c4bd0e7ed in Poco::Logger::add(Poco::AutoPtr<Poco::Logger>) (/usr/lib64/libPocoFoundation.so.92+0xf57ed)

Given that Log::setThreadLocalLogLevel() calls GenericLogger::create(),
which calls Poco::Logger::add(); and given that
StaticHelper::setThreadLocalLogger() explicitly leaks loggers, fix the
problem by returning earlier in Log::setThreadLocalLogLevel() for the
fuzzing case, the new logger would not be activated anyway.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I0d7a6c9caf6e1498f898d3dbecccd278ed722947
vmiklos added a commit that referenced this pull request Jun 21, 2024
The failure was:

	==79463== ERROR: libFuzzer: out-of-memory (used: 2053Mb; limit: 2048Mb)
	392260464 byte(s) (45%) in 5448062 allocation(s)
	    #0 0x5648cd721266 in operator new(unsigned long) /home/abuild/rpmbuild/BUILD/llvm-15.0.7.src/build/../projects/compiler-rt/lib/asan/asan_new_delete.cpp:95:3
	    #1 0x7f8c4bd0e7ed in Poco::Logger::add(Poco::AutoPtr<Poco::Logger>) (/usr/lib64/libPocoFoundation.so.92+0xf57ed)

Given that Log::setThreadLocalLogLevel() calls GenericLogger::create(),
which calls Poco::Logger::add(); and given that
StaticHelper::setThreadLocalLogger() explicitly leaks loggers, fix the
problem by returning earlier in Log::setThreadLocalLogLevel() for the
fuzzing case, the new logger would not be activated anyway.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I0d7a6c9caf6e1498f898d3dbecccd278ed722947
vmiklos added a commit that referenced this pull request Jun 21, 2024
The failure was:

	==79463== ERROR: libFuzzer: out-of-memory (used: 2053Mb; limit: 2048Mb)
	392260464 byte(s) (45%) in 5448062 allocation(s)
	    #0 0x5648cd721266 in operator new(unsigned long) /home/abuild/rpmbuild/BUILD/llvm-15.0.7.src/build/../projects/compiler-rt/lib/asan/asan_new_delete.cpp:95:3
	    #1 0x7f8c4bd0e7ed in Poco::Logger::add(Poco::AutoPtr<Poco::Logger>) (/usr/lib64/libPocoFoundation.so.92+0xf57ed)

Given that Log::setThreadLocalLogLevel() calls GenericLogger::create(),
which calls Poco::Logger::add(); and given that
StaticHelper::setThreadLocalLogger() explicitly leaks loggers, fix the
problem by returning earlier in Log::setThreadLocalLogLevel() for the
fuzzing case, the new logger would not be activated anyway.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I0d7a6c9caf6e1498f898d3dbecccd278ed722947
caolanm added a commit that referenced this pull request Aug 20, 2024
Direct leak of 104 byte(s) in 1 object(s) allocated from:
    #0 0x8a2200 in __interceptor_calloc
    #1 0x7f6fc253d114 in cap_init (/usr/lib64/libcap.so.2+0x3114)
    #2 0xaa6b57 in haveCorrectCapabilities() kit/ForKit.cpp:261:10
    #3 0xa9e77e in forkit_main(int, char**) kit/ForKit.cpp:778:50
    #4 0x110a0ad in main kit/forkit-main.cpp:19:12
    #5 0x7f6fc1bb424c in __libc_start_main (/lib64/libc.so.6+0x3524c)

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I74f8c01f3e5db12a690fa9fbfcd858fe0740f16e
caolanm added a commit that referenced this pull request Aug 21, 2024
Direct leak of 104 byte(s) in 1 object(s) allocated from:
    #0 0x8a2200 in __interceptor_calloc
    #1 0x7f6fc253d114 in cap_init (/usr/lib64/libcap.so.2+0x3114)
    #2 0xaa6b57 in haveCorrectCapabilities() kit/ForKit.cpp:261:10
    #3 0xa9e77e in forkit_main(int, char**) kit/ForKit.cpp:778:50
    #4 0x110a0ad in main kit/forkit-main.cpp:19:12
    #5 0x7f6fc1bb424c in __libc_start_main (/lib64/libc.so.6+0x3524c)

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I74f8c01f3e5db12a690fa9fbfcd858fe0740f16e
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)
@sgothel sgothel mentioned this pull request Oct 30, 2024
5 tasks
caolanm added a commit that referenced this pull request Oct 30, 2024
we lock this elsewhere when writing

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I2360e71f7420ae96486c0a95fff77640c4bef29e
caolanm added a commit that referenced this pull request Nov 13, 2024
so there isn't a mystery thread with the same name as the
parent process.

i.e. a diff on:
pstree -plt `pgrep coolwsd`
of;

 coolwsd(1753433)─┬─forkit(1753438)───kit_spare_001(1753456)
                  ├─{#1}(1753434)
                  ├─{accept_poll}(1753458)
                  ├─{admin}(1753460)
-                 ├─{coolwsd}(1753436)
+                 ├─{asyncdns}(1753436)
                  ├─{prisoner_poll}(1753437)
                  ├─{remotefontconfi}(1753457)
                  └─{websrv_poll}(1753459)

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ic63c2be172212b3fba6f80b7da4118c89dbba6a1
caolanm added a commit that referenced this pull request Nov 14, 2024
so there isn't a mystery thread with the same name as the
parent process.

i.e. a diff on:
pstree -plt `pgrep coolwsd`
of;

 coolwsd(1753433)─┬─forkit(1753438)───kit_spare_001(1753456)
                  ├─{#1}(1753434)
                  ├─{accept_poll}(1753458)
                  ├─{admin}(1753460)
-                 ├─{coolwsd}(1753436)
+                 ├─{asyncdns}(1753436)
                  ├─{prisoner_poll}(1753437)
                  ├─{remotefontconfi}(1753457)
                  └─{websrv_poll}(1753459)

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ic63c2be172212b3fba6f80b7da4118c89dbba6a1
vmiklos pushed a commit that referenced this pull request Nov 14, 2024
so there isn't a mystery thread with the same name as the
parent process.

i.e. a diff on:
pstree -plt `pgrep coolwsd`
of;

 coolwsd(1753433)─┬─forkit(1753438)───kit_spare_001(1753456)
                  ├─{#1}(1753434)
                  ├─{accept_poll}(1753458)
                  ├─{admin}(1753460)
-                 ├─{coolwsd}(1753436)
+                 ├─{asyncdns}(1753436)
                  ├─{prisoner_poll}(1753437)
                  ├─{remotefontconfi}(1753457)
                  └─{websrv_poll}(1753459)

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ic63c2be172212b3fba6f80b7da4118c89dbba6a1
caolanm added a commit that referenced this pull request Dec 6, 2024
 #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
 #1  0x00007f5eba5167f1 in __GI_abort () at abort.c:79
 #2  0x0000000000bee08e in std::__glibcxx_assert_fail(char const*, int, char const*, char const*) ()
 #3  0x00000000005cf12f in std::vector<char, std::allocator<char> >::operator[] (__n=0, this=0x7f5e397e7260)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:1121
 #4  0x00000000005f2b46 in std::vector<char, std::allocator<char> >::operator[] (__n=<optimized out>, this=<optimized out>)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_iterator.h:1072
 #5  WebSocketHandler::handleTCPStream (this=this@entry=0x7f5ea09a62d0, socket=std::shared_ptr<StreamSocket> (use count 3, weak count 2) = {...})
     at ./net/WebSocketHandler.hpp:431
 #6  0x00000000005f39d5 in WebSocketHandler::handleIncomingMessage (this=0x7f5ea09a62d0) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/allocator.h:174
 #7  0x000000000082e66e in StreamSocket::handlePoll (this=0x7f5ea42094d0, disposition=..., now=..., events=1)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/shared_ptr_base.h:1665

sendPong(now, &ctrlPayload[0], payloadLen, socket);

(gdb) print ctrlPayload
$1 = std::vector of length 0, capacity 0
(gdb) print payloadLen
$2 = 0

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ib5ee3b302adeef09b8c320caf7f65be2ad980beb
mmeeks pushed a commit that referenced this pull request Dec 6, 2024
 #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
 #1  0x00007f5eba5167f1 in __GI_abort () at abort.c:79
 #2  0x0000000000bee08e in std::__glibcxx_assert_fail(char const*, int, char const*, char const*) ()
 #3  0x00000000005cf12f in std::vector<char, std::allocator<char> >::operator[] (__n=0, this=0x7f5e397e7260)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:1121
 #4  0x00000000005f2b46 in std::vector<char, std::allocator<char> >::operator[] (__n=<optimized out>, this=<optimized out>)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_iterator.h:1072
 #5  WebSocketHandler::handleTCPStream (this=this@entry=0x7f5ea09a62d0, socket=std::shared_ptr<StreamSocket> (use count 3, weak count 2) = {...})
     at ./net/WebSocketHandler.hpp:431
 #6  0x00000000005f39d5 in WebSocketHandler::handleIncomingMessage (this=0x7f5ea09a62d0) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/allocator.h:174
 #7  0x000000000082e66e in StreamSocket::handlePoll (this=0x7f5ea42094d0, disposition=..., now=..., events=1)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/shared_ptr_base.h:1665

sendPong(now, &ctrlPayload[0], payloadLen, socket);

(gdb) print ctrlPayload
$1 = std::vector of length 0, capacity 0
(gdb) print payloadLen
$2 = 0

Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: Ib5ee3b302adeef09b8c320caf7f65be2ad980beb
timar pushed a commit that referenced this pull request Dec 6, 2024
 #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
 #1  0x00007f5eba5167f1 in __GI_abort () at abort.c:79
 #2  0x0000000000bee08e in std::__glibcxx_assert_fail(char const*, int, char const*, char const*) ()
 #3  0x00000000005cf12f in std::vector<char, std::allocator<char> >::operator[] (__n=0, this=0x7f5e397e7260)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_vector.h:1121
 #4  0x00000000005f2b46 in std::vector<char, std::allocator<char> >::operator[] (__n=<optimized out>, this=<optimized out>)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/stl_iterator.h:1072
 #5  WebSocketHandler::handleTCPStream (this=this@entry=0x7f5ea09a62d0, socket=std::shared_ptr<StreamSocket> (use count 3, weak count 2) = {...})
     at ./net/WebSocketHandler.hpp:431
 #6  0x00000000005f39d5 in WebSocketHandler::handleIncomingMessage (this=0x7f5ea09a62d0) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/allocator.h:174
 #7  0x000000000082e66e in StreamSocket::handlePoll (this=0x7f5ea42094d0, disposition=..., now=..., events=1)
     at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/shared_ptr_base.h:1665

sendPong(now, &ctrlPayload[0], payloadLen, socket);

(gdb) print ctrlPayload
$1 = std::vector of length 0, capacity 0
(gdb) print payloadLen
$2 = 0

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

2 participants