D18245: [DrKonqi] Create QApplication in a scope to fix possible deadlock

Christoph Roick noreply at phabricator.kde.org
Tue Jan 15 16:37:47 GMT 2019


croick added a comment.


  **GDB**
  Actually the problem is about joining threads at the end of `main()`. After being stuck and `kill -SIGSTOP $(pidof kdevelop)`, DrKonqi turns out to be here:
  
    #0  0x00007fbf18adbf6d in __pthread_timedjoin_ex () from /usr/lib/libpthread.so.0
    #1  0x00007fbf0aee0a01 in ?? () from /usr/lib/dri/i965_dri.so
    #2  0x00007fbf0aee1299 in ?? () from /usr/lib/dri/i965_dri.so
    #3  0x00007fbf0aedc76a in ?? () from /usr/lib/dri/i965_dri.so
    --Type <RET> for more, q to quit, c to continue without paging--c
    #4  0x00007fbf0ae66374 in ?? () from /usr/lib/dri/i965_dri.so
    #5  0x00007fbf0aed83ff in ?? () from /usr/lib/dri/i965_dri.so
    #6  0x00007fbf0bd4b04c in ?? () from /usr/lib/libGLX_mesa.so.0
    #7  0x00007fbf0bd37822 in ?? () from /usr/lib/libGLX_mesa.so.0
    #8  0x00007fbf0bd378a9 in ?? () from /usr/lib/libGLX_mesa.so.0
    #9  0x00007fbf0bd379fe in ?? () from /usr/lib/libGLX_mesa.so.0
    #10 0x00007fbf18d893e2 in XCloseDisplay () from /usr/lib/libX11.so.6
    #11 0x00007fbf144b8fe2 in ?? () from /usr/lib/libQt5XcbQpa.so.5
    #12 0x00007fbf1448e33a in QXcbConnection::~QXcbConnection() () from /usr/lib/libQt5XcbQpa.so.5
    #13 0x00007fbf1448f5f7 in QXcbIntegration::~QXcbIntegration() () from /usr/lib/libQt5XcbQpa.so.5
    #14 0x00007fbf1448f6fa in QXcbIntegration::~QXcbIntegration() () from /usr/lib/libQt5XcbQpa.so.5
    #15 0x00007fbf1a0c5f29 in QGuiApplicationPrivate::~QGuiApplicationPrivate() () from /usr/lib/libQt5Gui.so.5
    #16 0x00007fbf1a6c370a in QApplicationPrivate::~QApplicationPrivate() () from /usr/lib/libQt5Widgets.so.5
    #17 0x00007fbf19d2e1cf in QObject::~QObject() () from /usr/lib/libQt5Core.so.5
    #18 0x00007fbf19cfed10 in QCoreApplication::~QCoreApplication() () from /usr/lib/libQt5Core.so.5
    #19 0x00007fbf1a6c5852 in QApplication::~QApplication() () from /usr/lib/libQt5Widgets.so.5
    #20 0x0000558afb850900 in main (argc=<optimized out>, argv=<optimized out>) at /home/christoph/Software/kde/kde/workspace/drkonqi/src/main.cpp:148
  
  **strace**
  
  - `$ kill -SIGSEGV $(pidof kdevelop)`
  - let DrKonqi fire up
  - `$ strace -fp $(pidof drkonqi)`
    - `strace: Process 9554 attached with 4 threads`
  - close the DrKonqi dialog
  
  strace output:
  
    .
    .
    .
    [pid  9556] poll([{fd=7, events=POLLIN}, {fd=8, events=POLLIN}], 2, -1 <unfinished ...>
    [pid  9554] <... poll resumed> )        = 1 ([{fd=3, revents=POLLOUT}])
    [pid  9554] writev(3, [{iov_base="<\0\2\0\20\0@\0106\0\2\0\17\0@\10\206\6\2\0\10\0@\10\4\0\2\0\7\0@\10"..., iov_len=124}], 1) = 124
    [pid  9554] futex(0x55aa7e92a300, FUTEX_WAIT_PRIVATE, 0, NULL <unfinished ...>
    [pid  9555] <... poll resumed> )        = 1 ([{fd=3, revents=POLLIN}])
    [pid  9555] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\22\08\3\7\0@\10\7\0@\10\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 64
    [pid  9555] poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
    [pid  9555] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\t\58\3\7\0@\10\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 32
    [pid  9555] poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
    [pid  9555] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\10\08\3\25\332I\0H\1\0\0\7\0@\10\0\0\0\0\233\3\225\1L\2)\1\20\0\0\3"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 108
    [pid  9555] poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
    [pid  9555] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\21\08\3\7\0@\10\7\0@\10\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 928
    [pid  9555] poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
    [pid  9555] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\241 ;\3\21\0@\10Q\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 32
    [pid  9555] close(4)                    = 0
    [pid  9555] futex(0x55aa7e92a300, FUTEX_WAKE_PRIVATE, 2147483647) = 1
    [pid  9555] madvise(0x7f5dab453000, 8368128, MADV_DONTNEED) = 0
    [pid  9555] exit(0)                     = ?
    [pid  9555] +++ exited with 0 +++
    [pid  9554] <... futex resumed> )       = 0
    [pid  9554] futex(0x55aa7e92a2b0, FUTEX_WAKE_PRIVATE, 1) = 0
    [pid  9554] poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLIN|POLLOUT}])
    [pid  9554] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\34\0<\3H\1\0\0\204\1\0\0\33\332I\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 32
    [pid  9554] writev(3, [{iov_base=".\0\2\0\3\0@\10_\0\2\0\f\0@\10", iov_len=16}], 1) = 16
    [pid  9554] poll([{fd=3, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=3, revents=POLLOUT}])
    [pid  9554] writev(3, [{iov_base="<\27\2\0\0\0@\10+\0\1\0", iov_len=12}, {iov_base=NULL, iov_len=0}, {iov_base="", iov_len=0}], 3) = 12
    [pid  9554] poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
    [pid  9554] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\34\0<\3H\1\0\0\266\1\0\0\35\332I\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 32
    [pid  9554] poll([{fd=3, events=POLLIN}], 1, -1) = 1 ([{fd=3, revents=POLLIN}])
    [pid  9554] recvmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\34\0<\3H\1\0\0\267\1\0\0\35\332I\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, 0) = 96
    [pid  9554] futex(0x55aa7ea93ac8, FUTEX_WAKE_PRIVATE, 2147483647) = 1
    [pid  9554] futex(0x7f5da2df59d0, FUTEX_WAIT, 9557, NULL
  
  Afterwards nothing happens, the CPU is (endlessly) busy doing something for kdevelop. Note how poll() in thread 9556 (QDBusConnection) never returned and is finally blocking the other threads.
  The FD 7 points to 'anon_inode:[eventfd]'
  
  - `$ kill -SIGSTOP $(pidof kdevelop)`
  
  strace output now resumes:
  
    [pid  9557] <... futex resumed> )       = 0
    [pid  9557] futex(0x55aa7ea93a78, FUTEX_WAKE_PRIVATE, 1) = 0
    [pid  9557] madvise(0x7f5da25f5000, 8368128, MADV_DONTNEED) = 0
    [pid  9557] exit(0)                     = ?
    [pid  9557] +++ exited with 0 +++
    [pid  9554] <... futex resumed> )       = 0
    [pid  9554] munmap(0x7f5da2df6000, 1310728) = 0
    [pid  9554] close(13)                   = 0
    [pid  9554] shutdown(3, SHUT_RDWR)      = 0
    [pid  9554] close(3)                    = 0
    [pid  9554] write(7, "\1\0\0\0\0\0\0\0", 8) = 8
    [pid  9556] <... poll resumed> )        = 1 ([{fd=7, revents=POLLIN}])
    .
    .
    .
    [pid  9556] exit(0)                     = ?
    [pid  9556] +++ exited with 0 +++
    getpid()                                = 9554
    exit_group(0)                           = ?
    +++ exited with 0 +++
  
  **kdevelop**
  stracing the kdevelop process at the same time shows, that a thread called "QQuickXmlQueryE" is blocked by a read()-syscall also with an eventfd.
  Actually all files are directly closed by KCrash, but as far as I understand the epoll mechanism, the epoll instance remains as long as there are processes using it, so close() might not have the desired effect.
  Might be that DrKonqi and KDevelop are trying to read from the same file. I cannot tell. https://patchwork.kernel.org/patch/10413589/ is not part of the kernel yet it seems.

REPOSITORY
  R871 DrKonqi

REVISION DETAIL
  https://phabricator.kde.org/D18245

To: croick, sitter, #kdevelop
Cc: plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20190115/6f9314e7/attachment-0001.html>


More information about the Plasma-devel mailing list