diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-02-28 23:12:11 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-03-01 09:12:04 +0100 |
commit | f8238187bad40d0a4b8eccbae9f99eca4aa10f7a (patch) | |
tree | 487b5bf5c0ae4e99f57d03bc7385e1518a9b11c0 /vcl | |
parent | fcfa854db5b81454047e1dde36de781e395dd498 (diff) |
Always join thread before destroying it
m_aDestThread had been added with 7d6c646ec244f9ea1db9b5bd160ecfc43ac27f13
"INTEGRATION: CWS vcl24", apparently for "#i28763# workaround possibly hanging
CUPS calls" to address <https://bz.apache.org/ooo/show_bug.cgi?id=28763>
"Loading document hangs if CUPS printer doesn't deliver PPD" and its duplicate
<https://bz.apache.org/ooo/show_bug.cgi?id=30513> "OO.o hangs if cupsd hangs".
However, PythonTest_sc_python now occasionally failed for me with a SIGSEGV in
thread #1 of python.bin at
> Thread 2 (Thread 0x7fc8df392fc0 (LWP 2268774)):
> #0 0x00007fc8df42ee28 in _int_free () at /lib64/libc.so.6
> #1 0x00007fc8df431c05 in free () at /lib64/libc.so.6
> #2 0x00007fc8df7e4fe9 in _PyMem_RawFree (ctx=0x0, ptr=0xff64c0) at workdir/UnpackedTarball/python3/Objects/obmalloc.c:127
> #3 0x00007fc8df7e5af7 in _PyMem_DebugRawFree (ctx=0x7fc8dfb36d88 <_PyMem_Debug>, p=0xff64d0) at workdir/UnpackedTarball/python3/Objects/obmalloc.c:2187
> #4 0x00007fc8df7e5ff0 in PyMem_RawFree (ptr=0xff64d0) at workdir/UnpackedTarball/python3/Objects/obmalloc.c:595
> #5 0x00007fc8df7e5301 in _PyObject_Free (ctx=0x0, p=0xff64d0) at workdir/UnpackedTarball/python3/Objects/obmalloc.c:1898
> #6 0x00007fc8df7e5af7 in _PyMem_DebugRawFree (ctx=0x7fc8dfb36de8 <_PyMem_Debug+96>, p=0xff64e0) at workdir/UnpackedTarball/python3/Objects/obmalloc.c:2187
> #7 0x00007fc8df7e5bb2 in _PyMem_DebugFree (ctx=0x7fc8dfb36de8 <_PyMem_Debug+96>, ptr=0xff64e0) at workdir/UnpackedTarball/python3/Objects/obmalloc.c:2318
> #8 0x00007fc8df7e64c0 in PyObject_Free (ptr=0xff64e0) at workdir/UnpackedTarball/python3/Objects/obmalloc.c:709
> #9 0x00007fc8df853d8d in unicode_dealloc (unicode=<unknown at remote 0xff64e0>) at workdir/UnpackedTarball/python3/Objects/unicodeobject.c:1879
> #10 0x00007fc8df7e47b6 in _Py_Dealloc (op=<unknown at remote 0xff64e0>) at workdir/UnpackedTarball/python3/Objects/object.c:2215
> #11 0x00007fc8df81aeff in _Py_DECREF (filename=0x7fc8dfa46c76 "Objects/unicodeobject.c", lineno=15296, op=<unknown at remote 0xff64e0>) at workdir/UnpackedTarball/python3/Include/object.h:478
> #12 0x00007fc8df81adc6 in PyUnicode_InternInPlace (p=0x7ffdf1d0b048) at workdir/UnpackedTarball/python3/Objects/unicodeobject.c:15296
> #13 0x00007fc8df7c7791 in PyDict_SetItemString (v={'__name__': 'sys', '__doc__': "This module provides access to some objects used or maintained by the\ninterpreter and to functions that interact strongly with the interpreter.\n\nDynamic objects:\n\nargv -- command line arguments; argv[0] is the script pathname if known\npath -- module search path; path[0] is the script directory, else ''\nmodules -- dictionary of loaded modules\n\ndisplayhook -- called to show results in an interactive session\nexcepthook -- called to handle any uncaught exception other than SystemExit\n To customize printing in an interactive session or to install a custom\n top-level exception handler, assign other functions to replace these.\n\nstdin -- standard input file object; used by input()\nstdout -- standard output file object; used by print()\nstderr -- standard error object; used for error messages\n By assigning other file objects (or objects that behave like files)\n to these, it is possible to redirect all of the interpreter's I/O.\n\nlast_type -- type of last uncaught e...(truncated), key=0x7fc8dfa71535 "stdin", item=<_io.TextIOWrapper at remote 0x1079630>) at workdir/UnpackedTarball/python3/Objects/dictobject.c:3416
> #14 0x00007fc8df92af89 in PyImport_Cleanup () at workdir/UnpackedTarball/python3/Python/import.c:447
> #15 0x00007fc8df94af6d in Py_FinalizeEx () at workdir/UnpackedTarball/python3/Python/pylifecycle.c:1229
> #16 0x00007fc8df981f2d in Py_RunMain () at workdir/UnpackedTarball/python3/Modules/main.c:691
> #17 0x00007fc8df9822fd in pymain_main (args=0x7ffdf1d0b1f0) at workdir/UnpackedTarball/python3/Modules/main.c:719
> #18 0x00007fc8df982347 in Py_BytesMain (argc=4, argv=0x7ffdf1d0b378) at workdir/UnpackedTarball/python3/Modules/main.c:743
> #19 0x0000000000401152 in main (argc=4, argv=0x7ffdf1d0b378) at workdir/UnpackedTarball/python3/Programs/python.c:16
> #20 0x00007fc8df3c1560 in __libc_start_call_main () at /lib64/libc.so.6
> #21 0x00007fc8df3c160c in __libc_start_main_impl () at /lib64/libc.so.6
> #22 0x0000000000401065 in _start ()
>
> Thread 1 (Thread 0x7fc8be2dc640 (LWP 2269049)):
> #0 0x00007fc8df424e24 in pthread_mutex_lock@@GLIBC_2.2.5 () at /lib64/libc.so.6
> #1 0x00007fc8d19a8e57 in osl_acquireMutex(oslMutex) (pMutex=0xcdcdcdcdcdcdcdcd) at sal/osl/unx/mutex.cxx:100
> #2 0x00007fc8ce0870b8 in osl::Mutex::acquire() (this=0x2b9f120) at include/osl/mutex.hxx:61
> #3 0x00007fc8ce18a2a3 in osl::Guard<osl::Mutex>::Guard(osl::Mutex&) (this=0x7fc8be2dbd88, t=...) at include/osl/mutex.hxx:142
> #4 0x00007fc8cec6dbb6 in psp::CUPSManager::runDests() (this=0x2b9ef40) at vcl/unx/generic/printer/cupsmgr.cxx:246
> #5 0x00007fc8cec6d965 in psp::CUPSManager::runDestThread(void*) (pThis=0x2b9ef40) at vcl/unx/generic/printer/cupsmgr.cxx:223
> #6 0x00007fc8cec6d7f1 in run_dest_thread_stub(void*) (pThis=0x2b9ef40) at vcl/unx/generic/printer/cupsmgr.cxx:193
> #7 0x00007fc8d19c9f2d in osl_thread_start_Impl(void*) (pData=0x30a9aa0) at sal/osl/unx/thread.cxx:264
> #8 0x00007fc8df421b1a in start_thread () at /lib64/libc.so.6
> #9 0x00007fc8df4a6650 in clone3 () at /lib64/libc.so.6
Hoping that any blocking (if that is even still an issue today) is not
indefinite, turn this one osl_terminateThread into osl_joinWithThread as already
used in all the other places (CUPSManager::initialize,
CUPSManager::checkPrintersChanged). (Also note that osl_terminateThread was
effectively a no-op here, as the relevant thread never calls
osl_scheduleThread.)
Change-Id: Ic9c6d6dba1c42f802e09e95feaa7e4d093b5b2cd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130732
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/generic/printer/cupsmgr.cxx | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx index 5c7fb3013e73..29f4b16b54b1 100644 --- a/vcl/unx/generic/printer/cupsmgr.cxx +++ b/vcl/unx/generic/printer/cupsmgr.cxx @@ -208,9 +208,7 @@ CUPSManager::~CUPSManager() { if( m_aDestThread ) { - // if the thread is still running here, then - // cupsGetDests is hung; terminate the thread instead of joining - osl_terminateThread( m_aDestThread ); + osl_joinWithThread( m_aDestThread ); osl_destroyThread( m_aDestThread ); } |