Bug 286991

Summary: kgpg hangs when trying to decrypt a signature
Product: [Applications] kgpg Reporter: Richard Weinberger <richard-bugs>
Component: generalAssignee: Rolf Eike Beer <kde>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: 2.6.x   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 4.7.4
Sentry Crash Report:
Attachments: the funky signature

Description Richard Weinberger 2011-11-19 12:55:14 UTC
Application: kgpg (2.6.2)
KDE Platform Version: 4.7.3 (4.7.3) "release 10"
Qt Version: 4.7.4
Operating System: Linux 2.6.37.6-0.9-desktop x86_64
Distribution: "openSUSE 11.4 (x86_64)"

-- Information about the crash:
kgpg was running for ~30minutes in the background.
Then it crashed without any interaction from my side...

The crash can be reproduced some of the time.

-- Backtrace:
Application: KGpg (kgpg), signal: Aborted
82	T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS)
[KCrash Handler]
#6  0x00007f5242cb1ab5 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#7  0x00007f5242cb2fb6 in abort () at abort.c:92
#8  0x00007f52430aaaed in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib64/libstdc++.so.6
#9  0x00007f52430a8d06 in ?? () from /usr/lib64/libstdc++.so.6
#10 0x00007f52430a8d33 in std::terminate() () from /usr/lib64/libstdc++.so.6
#11 0x00007f52430a8e86 in __cxa_rethrow () from /usr/lib64/libstdc++.so.6
#12 0x00007f5243457f03 in QEventLoop::exec (this=0x7fff5d562c60, flags=...) at kernel/qeventloop.cpp:214
#13 0x00007f524345c27b in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1064
#14 0x0000000000475794 in main (argc=3, argv=0x7fff5d563128) at /usr/src/debug/kdeutils-4.7.3/kgpg/main.cpp:57

Possible duplicates by query: bug 286980, bug 286977, bug 286969, bug 286903, bug 286868.

Reported using DrKonqi
Comment 1 Rolf Eike Beer 2011-11-19 14:07:41 UTC
This looks very much like some assertion is hit. Please start KGpg from a terminal session and paste the output that happens shortly before the crash here.
Comment 2 Richard Weinberger 2011-11-19 14:11:13 UTC
Will do, but the crash happens only very rarely...
Comment 3 Richard Weinberger 2011-11-19 19:33:19 UTC
There you go!

--->8---
Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there.

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
KCrash: Application 'kgpg' crashing.
---8<---
Comment 4 Rolf Eike Beer 2011-11-20 10:39:04 UTC
Ok, there is some sort of memleak happening. Could you try running

valgrind --leak-check=full kgpg --nofork

This will likely be rather slow but hopefully gives me a clue what's going on.
Comment 5 Richard Weinberger 2011-11-20 14:28:56 UTC
Created attachment 65870 [details]
the funky signature
Comment 6 Richard Weinberger 2011-11-20 14:29:42 UTC
This is not going to work.
I had some time to look a bit closer at the problem.
Kgpg seems to get stuck in an infinite loop by opening the attached pgp-signature.
Within this loop it allocates from time to time some memory, after a few hours it crashes...

You can reproduce the issue as follows:
1. kgpg --nofork
on a second shell:
2. kgpg signature.asc

Now the first kgpg process consumes 100% cpu until it crashes due to std:bad_alloc.
Comment 7 Rolf Eike Beer 2011-11-20 14:52:32 UTC
Thanks for the info, now I know what is happening. KGpg tries to decrypt the signature and gots stuck in it's communication with the underlying gpg process.
Comment 8 Rolf Eike Beer 2011-11-20 15:37:46 UTC
Git commit de841cf6a13d5c2ff5bb3cdb9002acc3afae05c9 by Rolf Eike Beer.
Committed on 20/11/2011 at 16:36.
Pushed by dakon into branch 'KDE/4.7'.

prevent KGpg to endlessly loop while trying to decrypt a detached signature

This can't work, so there is no value in trying it.

BUG:286991

M  +3    -0    kgpgtextinterface.cpp

http://commits.kde.org/kgpg/de841cf6a13d5c2ff5bb3cdb9002acc3afae05c9