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

2.3.0 freezes after some time #1574

Closed
klemens opened this issue Mar 1, 2018 · 23 comments
Closed

2.3.0 freezes after some time #1574

klemens opened this issue Mar 1, 2018 · 23 comments

Comments

@klemens
Copy link

klemens commented Mar 1, 2018

Steps to Reproduce

Version 2.3.0 freezed two times for me today under linux (using the official arch package) while being locked and minimized to tray. It did not respond to any signals, so I had to SIGKILL it.

This sounds very similar to #1561, but I didn't get a segfault, so I am not really sure…

Here is the backtrace of the second freeze, which doesn't have symbols unfortunately. However I just recompiled the package with debug symbols, so I can hopefully provide a better backtrace soon.

Backtrace of the main thread
Thread 1 (Thread 0x7f55b8e151c0 (LWP 715)):
#0  0x00007f55b57553d8 in read () at /usr/lib/libc.so.6
#1  0x00007f55b56e8528 in __GI__IO_file_underflow () at /usr/lib/libc.so.6
#2  0x00007f55b56e7588 in __GI__IO_file_xsgetn () at /usr/lib/libc.so.6
#3  0x00007f55b56dbbe1 in fread () at /usr/lib/libc.so.6
#4  0x00007f55b5e5e03e in __gnu_cxx::stdio_sync_filebuf<char, std::char_traits<char> >::xsgetn(char*, long) (this=0x7f55b60f4ce0 <__gnu_internal::buf_cin_sync>, __s=0x7ffcd8037f14 "", __n=<optimized out>)
    at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/stdio_sync_filebuf.h:241
#5  0x00007f55b5e6cf8b in std::basic_streambuf<char, std::char_traits<char> >::sgetn(char*, long) (__n=4, __s=0x7ffcd8037f14 "", this=<optimized out>) at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/streambuf:358
#6  0x00007f55b5e6cf8b in std::istream::read(char*, long) (this=0x7f55b60f5580 <std::cin>, __s=0x7ffcd8037f14 "", __n=4)
    at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/istream.tcc:667
#7  0x000055877372aeab in  ()
#8  0x000055877373f8eb in  ()
#9  0x00007f55b63c56c6 in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/libQt5Core.so.5
#10 0x00007f55b63d1fa9 in QSocketNotifier::activated(int, QSocketNotifier::QPrivateSignal) () at /usr/lib/libQt5Core.so.5
#11 0x00007f55b63d2384 in QSocketNotifier::event(QEvent*) () at /usr/lib/libQt5Core.so.5
#12 0x00007f55b7f67fec in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#13 0x00007f55b7f6f9c6 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#14 0x00007f55b6394da0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#15 0x00007f55b63f1f8e in  () at /usr/lib/libQt5Core.so.5
#16 0x00007f55b1563e38 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#17 0x00007f55b1564081 in  () at /usr/lib/libglib-2.0.so.0
#18 0x00007f55b156410e in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#19 0x00007f55b63f12f1 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#20 0x00007f55ac5c1482 in  () at /usr/lib/libQt5XcbQpa.so.5
#21 0x00007f55b63933db in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#22 0x00007f55b639c7d8 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#23 0x00005587735cbf44 in  ()
#24 0x00007f55b568ef4a in __libc_start_main () at /usr/lib/libc.so.6
#25 0x00005587735cd8da in _start ()

Debug Info

KeePassXC - Version 2.3.0
Revision: 4c0ed74

Bibliotheken:

  • Qt 5.10.1
  • libgcrypt 1.8.2

Betriebssystem: Arch Linux
CPU-Architektur: x86_64
Kernel: linux 4.15.5-1-ARCH

Aktivierte Erweiterungen:

  • Auto-Type
@droidmonkey
Copy link
Member

Doesn't look like any keepassxc code is called in that dump.

@TheZ3ro
Copy link
Contributor

TheZ3ro commented Mar 1, 2018

It's a Release build without debug information sadly, the backtrace isn't very useful.

@klemens
Copy link
Author

klemens commented Mar 1, 2018

Yup, thats why I recompiled the package with symbols. I guess the addresses 0x0000558… are the keepassxc code?

@phoerious
Copy link
Member

Addresses don't help us. They can be anything. We need code lines or at least symbols.

@phoerious
Copy link
Member

Maybe this crash has something to do with single-instance mode or KeePassXC-Browser. There are a few occurrences of QSocketNotifier in the back trace

@klemens
Copy link
Author

klemens commented Mar 2, 2018

It froze again, so I now have a backtrace with most symbols:

It seems related to some of the new browser integration code which is weird because I have both browser integration options disabled and only use autotype.

Backtrace of main thread (all other threads just waiting on some poll or condition variable)
#0  0x00007f8b2895f3d8 in read () at /usr/lib/libc.so.6
#1  0x00007f8b288f2528 in __GI__IO_file_underflow () at /usr/lib/libc.so.6
#2  0x00007f8b288f1588 in __GI__IO_file_xsgetn () at /usr/lib/libc.so.6
#3  0x00007f8b288e5be1 in fread () at /usr/lib/libc.so.6
#4  0x00007f8b2906803e in __gnu_cxx::stdio_sync_filebuf<char, std::char_traits<char> >::xsgetn(char*, long) (this=
    0x7f8b292fece0 <__gnu_internal::buf_cin_sync>, __s=0x7ffe7d0a5ec4 "", __n=<optimized out>)
    at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/stdio_sync_filebuf.h:241
#5  0x00007f8b29076f8b in std::basic_streambuf<char, std::char_traits<char> >::sgetn(char*, long) (__n=4, __s=0x7ffe7d0a5ec4 "", this=<optimized out>) at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/streambuf:358
#6  0x00007f8b29076f8b in std::istream::read(char*, long) (this=this@entry=0x7f8b292ff580 <std::cin>, __s=__s@entry=0x7ffe7d0a5ec4 "", __n=__n@entry=4) at /build/gcc/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/istream.tcc:667
#7  0x000056546f75feab in NativeMessagingHost::readLength() (this=0x565471ab79b0)
    at /tmp/keepassxc/repos/community-x86_64/src/keepassxc-2.3.0/src/browser/NativeMessagingHost.cpp:100
#8  0x000056546f7748eb in NativeMessagingBase::newNativeMessage() (this=0x565471ab79b0)
    at /tmp/keepassxc/repos/community-x86_64/src/keepassxc-2.3.0/src/browser/NativeMessagingBase.cpp:90
#9  0x00007f8b295cf6c6 in QMetaObject::activate(QObject*, int, int, void**) () at /usr/lib/libQt5Core.so.5
#10 0x00007f8b295dbfa9 in QSocketNotifier::activated(int, QSocketNotifier::QPrivateSignal) () at /usr/lib/libQt5Core.so.5
#11 0x00007f8b295dc384 in QSocketNotifier::event(QEvent*) () at /usr/lib/libQt5Core.so.5
#12 0x00007f8b2b171fec in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#13 0x00007f8b2b1799c6 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/libQt5Widgets.so.5
#14 0x00007f8b2959eda0 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/libQt5Core.so.5
#15 0x00007f8b295fbf8e in  () at /usr/lib/libQt5Core.so.5
#16 0x00007f8b2476de38 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#17 0x00007f8b2476e081 in  () at /usr/lib/libglib-2.0.so.0
#18 0x00007f8b2476e10e in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#19 0x00007f8b295fb2f1 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#20 0x00007f8b1f7cb482 in  () at /usr/lib/libQt5XcbQpa.so.5
#21 0x00007f8b2959d3db in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt5Core.so.5
#22 0x00007f8b295a67d8 in QCoreApplication::exec() () at /usr/lib/libQt5Core.so.5
#23 0x000056546f600f44 in main(int, char**) (argc=<optimized out>, argv=<optimized out>)
    at /tmp/keepassxc/repos/community-x86_64/src/keepassxc-2.3.0/src/main.cpp:155

@phoerious
Copy link
Member

phoerious commented Mar 2, 2018

NativeMessagingHost.cpp:100 is weird. That line is Windows-only. I can see, though, how that could create freezes were it compiled in.

@varjolintu
Copy link
Member

Same with the proxy/NativeMessagingHost.cpp:44.

@droidmonkey
Copy link
Member

droidmonkey commented Mar 3, 2018

@phoerious Line 100 is not Windows-only, It is super weird and needs to be eliminated, I do not like it at all.

The function "readLength()" is called here.

I think the readLength() function is poorly named (it actually reads the length and then goes on to read the rest of stdin!).

@phoerious
Copy link
Member

phoerious commented Mar 4, 2018

Line 100 is inside an #ifdef Q_OS_WIN.

Edit: ah, I was in the Base file, not the Host file, somehow. Now the stacktrace makes more sense.

@ajaeger
Copy link

ajaeger commented Apr 24, 2018

Happens for me as well - if I minimize keepassxc for some time, it's frozen.

Thread 1 "keepassxc" received signal SIGTTIN, Stopped (tty input).
0x00007f7770fd0b78 in read () from /lib64/libc.so.6
(gdb) bt
#0 0x00007f7770fd0b78 in read () from /lib64/libc.so.6
#1 0x00007f7770f634c8 in __GI__IO_file_underflow () from /lib64/libc.so.6
#2 0x00007f7770f62538 in __GI__IO_file_xsgetn () from /lib64/libc.so.6
#3 0x00007f7770f56be1 in fread () from /lib64/libc.so.6
#4 0x00007f77716ddcad in __gnu_cxx::stdio_sync_filebuf<char, std::char_traits >::xsgetn(char*, long) ()
from /usr/lib64/libstdc++.so.6
#5 0x00007f77716ec11b in std::istream::read(char*, long) () from /usr/lib64/libstdc++.so.6
#6 0x000055ba8e1dfe6a in NativeMessagingHost::readLength (this=0x55ba8fa19de0)
at /usr/src/debug/keepassxc-2.3.1-lp150.1.2.x86_64/src/browser/NativeMessagingHost.cpp:100
#7 0x000055ba8e1f05a2 in NativeMessagingBase::newNativeMessage (this=0x55ba8fa19de0)
at /usr/src/debug/keepassxc-2.3.1-lp150.1.2.x86_64/src/browser/NativeMessagingBase.cpp:90
#8 0x00007f7771c2504a in QMetaObject::activate(QObject*, int, int, void**) () from /usr/lib64/libQt5Core.so.5
#9 0x00007f7771c30eb8 in QSocketNotifier::activated(int, QSocketNotifier::QPrivateSignal) () from /usr/lib64/libQt5Core.so.5
#10 0x00007f7771c31222 in QSocketNotifier::event(QEvent*) () from /usr/lib64/libQt5Core.so.5
#11 0x00007f77737e3e8c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#12 0x00007f77737eb244 in QApplication::notify(QObject*, QEvent*) () from /usr/lib64/libQt5Widgets.so.5
#13 0x00007f7771bf7a88 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /usr/lib64/libQt5Core.so.5
#14 0x00007f7771c4e7ed in ?? () from /usr/lib64/libQt5Core.so.5
#15 0x00007f776ce34f57 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#16 0x00007f776ce35190 in ?? () from /usr/lib64/libglib-2.0.so.0
#17 0x00007f776ce3521c in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#18 0x00007f7771c4dbef in QEventDispatcherGlib::processEvents(QFlagsQEventLoop::ProcessEventsFlag) ()
from /usr/lib64/libQt5Core.so.5
#19 0x00007f7771bf609a in QEventLoop::exec(QFlagsQEventLoop::ProcessEventsFlag) () from /usr/lib64/libQt5Core.so.5
#20 0x00007f7771bfe9e4 in QCoreApplication::exec() () from /usr/lib64/libQt5Core.so.5
#21 0x000055ba8e0aedd2 in main (argc=, argv=)
at /usr/src/debug/keepassxc-2.3.1-lp150.1.2.x86_64/src/main.cpp:159

@ajaeger
Copy link

ajaeger commented Apr 24, 2018

This even happens without minimizing ;(

Again "stopped" and debug shows
"Thread 1 "keepassxc" received signal SIGTTIN, Stopped (tty input).
0x00007f32cedf2b78 in read () from /lib64/libc.so.6" - with same backtrace

@varjolintu
Copy link
Member

A background process that attempts to read from or write to its controlling terminal is sent a SIGTTIN (for input) or SIGTTOU (for output) signal. These signals stop the process by default, but they may also be handled in other ways.

Maybe there's a way to handle this signal also in a way that it doesn't stop the process. In what way do you launch the KeePassXC process?

@ajaeger
Copy link

ajaeger commented Apr 24, 2018

I launched it from a shell in gnome-terminal with "keepassxc &". Running now in foreground...

Still I wonder why KeePassXC is reading from controlling terminal at all. That looks wrong to me for a GUI program.

@varjolintu
Copy link
Member

This happens because of native messaging. The workaround for you is to disable browser integration from the settings if you don't use it. I'll look into the issue.

@ajaeger
Copy link

ajaeger commented Apr 24, 2018

Thanks, @varjolintu . I wanted to use browser integration, one of the reasons for using it.

@varjolintu
Copy link
Member

@ajaeger And please try to launch it outside of a shell with the browser integration (from a menu etc) and try if it does the same.

@klemens
Copy link
Author

klemens commented Apr 24, 2018

The workaround for you is to disable browser integration

I my case I have browser integration disabled and it still hangs with the mentioned backtrace. So it seems the browser integration is still running somehow despite being disabled.

When I send SIGTTIN or SIGTTOU to a instance started in a terminal, it simply does standard job control as expected, so this is probably unrelated to the hang I experience, as my instance is started as a background task without any terminal attached? I can however try to send it a SIGCONT the next time it hangs and see if that helps.

@klemens
Copy link
Author

klemens commented Apr 27, 2018

So I tried sending a number of signals to a hanging process (including SIGCONT and SIGTERM), but none of these have any effect. The only thing that works is killing it using SIGKILL.

@varjolintu
Copy link
Member

I think I'll need to do a little fix: if the proxy is used KeePassXC itself won't listen STDIN at all. You are correct, it's still being listened even if the browser integration is disabled. Need to change that too.

@varjolintu
Copy link
Member

varjolintu commented Apr 29, 2018

@klemens varjolintu@86278b3 - this should fix the issue.

@klemens
Copy link
Author

klemens commented Apr 29, 2018

Thanks! I applied the patch on top of 2.3.1 and rebuilt. Will report back if I experience any more hangs.

@klemens
Copy link
Author

klemens commented May 9, 2018

I have not experienced any hangs with the patched version since my last comment, so it seems this has been fixed!

I just updated to 2.3.3 and will reopen this issue if there are still any problems.

@klemens klemens closed this as completed May 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants