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

Prevent a deadlock on process termination when using a SocketAppender #287

Merged
merged 1 commit into from
Nov 11, 2023

Conversation

swebb2066
Copy link
Contributor

Remove termination debug message that is not output as the LogLog singleton has been detroyed.

@swebb2066 swebb2066 merged commit fc6393e into master Nov 11, 2023
24 checks passed
@swebb2066 swebb2066 deleted the socket_appender_interrupt branch November 11, 2023 00:20
@swebb2066
Copy link
Contributor Author

For the record, using multithreadtest with XMLSocketAppender and no server listening on the TCP port, the deadlock is:

`(gdb) thread apply all bt

Thread 5 (Thread 0x7f45027fc640 (LWP 7473) "multithreadtest"):
#0 __futex_abstimed_wait_common64 (private=128, cancel=true, abstime=0x0, op=265, expected=7467, futex_word=0x7f4509a1b910) at ./nptl/futex-internal.c:57
#1 __futex_abstimed_wait_common (cancel=true, private=128, abstime=0x0, clockid=0, expected=7467, futex_word=0x7f4509a1b910) at ./nptl/futex-internal.c:87
#2 __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x7f4509a1b910, expected=7467, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=128) at ./nptl/futex-internal.c:139
#3 0x00007f450a1b7624 in __pthread_clockjoin_ex (threadid=139934491063872, thread_return=0x0, clockid=0, abstime=0x0, block=) at ./nptl/pthread_join_common.c:105
#4 0x00007f450a4452c7 in std::thread::join() () from /lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x00007f450a7c8259 in log4cxx::net::SocketAppenderSkeleton::close() () from /home/stephen/build/logging-log4cxx/src/main/cpp/liblog4cxx.so.15
#6 0x00007f450a6efa91 in log4cxx::helpers::AppenderAttachableImpl::removeAllAppenders() () from /home/stephen/build/logging-log4cxx/src/main/cpp/liblog4cxx.so.15
#7 0x00007f450a739ca4 in log4cxx::Hierarchy::~Hierarchy() () from /home/stephen/build/logging-log4cxx/src/main/cpp/liblog4cxx.so.15
#8 0x00007f450a73eada in std::_Sp_counted_ptr<log4cxx::Hierarchy*, (__gnu_cxx::_Lock_policy)2>::_M_dispose() () from /home/stephen/build/logging-log4cxx/src/main/cpp/liblog4cxx.so.15
#9 0x00007f450a714765 in log4cxx::spi::DefaultRepositorySelector::~DefaultRepositorySelector() () from /home/stephen/build/logging-log4cxx/src/main/cpp/liblog4cxx.so.15
#10 0x00007f450a6f488a in log4cxx::helpers::APRInitializer::~APRInitializer() () from /home/stephen/build/logging-log4cxx/src/main/cpp/liblog4cxx.so.15
#11 0x00007f450a166495 in __run_exit_handlers (status=0, listp=0x7f450a33a838 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at ./stdlib/exit.c:113
#12 0x00007f450a166610 in __GI_exit (status=) at ./stdlib/exit.c:143
#13 0x00007f450a1baee8 in __pthread_once_slow (once_control=0x557d5586a070 <multithread_logger(int)::exiting>, init_routine=0x7f450a443d50 <__once_proxy>) at ./nptl/pthread_once.c:116
#14 0x0000557d5585ea0b in multithread_logger(int) ()
#15 0x00007f450a445253 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#16 0x00007f450a1b5ac3 in start_thread (arg=) at ./nptl/pthread_create.c:442
#17 0x00007f450a247a40 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Thread 4 (Thread 0x7f45037fe640 (LWP 7471) "multithreadtest"):
#0 futex_wait (private=0, expected=1, futex_word=0x557d5586a070 <multithread_logger(int)::exiting>) at ../sysdeps/nptl/futex-internal.h:146
#1 futex_wait_simple (private=0, expected=1, futex_word=0x557d5586a070 <multithread_logger(int)::exiting>) at ../sysdeps/nptl/futex-internal.h:177
#2 __pthread_once_slow (once_control=0x557d5586a070 <multithread_logger(int)::exiting>, init_routine=0x7f450a443d50 <__once_proxy>) at ./nptl/pthread_once.c:105
#3 0x0000557d5585ea0b in multithread_logger(int) ()
#4 0x00007f450a445253 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x00007f450a1b5ac3 in start_thread (arg=) at ./nptl/pthread_create.c:442
#6 0x00007f450a247a40 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Thread 3 (Thread 0x7f450921a640 (LWP 7468) "multithreadtest"):
#0 futex_wait (private=0, expected=1, futex_word=0x557d5586a070 <multithread_logger(int)::exiting>) at ../sysdeps/nptl/futex-internal.h:146
#1 futex_wait_simple (private=0, expected=1, futex_word=0x557d5586a070 <multithread_logger(int)::exiting>) at ../sysdeps/nptl/futex-internal.h:177
#2 __pthread_once_slow (once_control=0x557d5586a070 <multithread_logger(int)::exiting>, init_routine=0x7f450a443d50 <__once_proxy>) at ./nptl/pthread_once.c:105
#3 0x0000557d5585ea0b in multithread_logger(int) ()
#4 0x00007f450a445253 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x00007f450a1b5ac3 in start_thread (arg=) at ./nptl/pthread_create.c:442
#6 0x00007f450a247a40 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Thread 2 (Thread 0x7f4509a1b640 (LWP 7467) "multithreadtest"):
#0 futex_wait (private=0, expected=2, futex_word=0x557d5629c948) at ../sysdeps/nptl/futex-internal.h:146
#1 __GI___lll_lock_wait (futex=futex@entry=0x557d5629c948, private=0) at ./nptl/lowlevellock.c:49
#2 0x00007f450a1b9002 in lll_mutex_lock_optimized (mutex=0x557d5629c948) at ./nptl/pthread_mutex_lock.c:48
#3 ___pthread_mutex_lock (mutex=0x557d5629c948) at ./nptl/pthread_mutex_lock.c:93
#4 0x00007f450a762c30 in log4cxx::helpers::LogLog::debug(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) () from /home/stephen/build/logging-log4cxx/src/main/cpp/liblog4cxx.so.15
#5 0x00007f450a7ca62e in log4cxx::net::SocketAppenderSkeleton::monitor() () from /home/stephen/build/logging-log4cxx/src/main/cpp/liblog4cxx.so.15
#6 0x00007f450a445253 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#7 0x00007f450a1b5ac3 in start_thread (arg=) at ./nptl/pthread_create.c:442
#8 0x00007f450a247a40 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Thread 1 (Thread 0x7f4509f91b80 (LWP 7466) "multithreadtest"):
#0 __futex_abstimed_wait_common64 (private=128, cancel=true, abstime=0x0, op=265, expected=7468, futex_word=0x7f450921a910) at ./nptl/futex-internal.c:57
#1 __futex_abstimed_wait_common (cancel=true, private=128, abstime=0x0, clockid=0, expected=7468, futex_word=0x7f450921a910) at ./nptl/futex-internal.c:87
#2 __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x7f450921a910, expected=7468, clockid=clockid@entry=0, abstime=abstime@entry=0x0, private=private@entry=128) at ./nptl/futex-internal.c:139
#3 0x00007f450a1b7624 in __pthread_clockjoin_ex (threadid=139934482671168, thread_return=0x0, clockid=0, abstime=0x0, block=) at ./nptl/pthread_join_common.c:105
#4 0x00007f450a4452c7 in std::thread::join() () from /lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x0000557d5585e237 in MultithreadTest::testMultithreadedLoggers() ()
--Type for more, q to quit, c to continue without paging--c
#6 0x0000557d5585dd42 in void LogUnit::runTest(abts_case*, void (MultithreadTest::)()) ()
#7 0x0000557d55860630 in abts_run_test(abts_suite
, char const*, void ()(abts_case, void*), void*) ()
#8 0x0000557d55861c31 in abts_run_suites(abts_suite*) ()
#9 0x0000557d5585cbd0 in main ()
(gdb)
`

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