Bug 183875 - kmail keeps spawning "gpgsm --server" but never kills/reaps them
Summary: kmail keeps spawning "gpgsm --server" but never kills/reaps them
Alias: None
Product: kmail2
Classification: Applications
Component: crypto (show other bugs)
Version: 5.1.3
Platform: Gentoo Packages Linux
: NOR normal with 20 votes (vote)
Target Milestone: ---
Assignee: David Faure
Depends on:
Reported: 2009-02-10 03:36 UTC by Mike Frysinger
Modified: 2017-04-03 07:01 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In: 17.04


Note You need to log in before you can comment on or make changes to this bug.
Description Mike Frysinger 2009-02-10 03:36:16 UTC
Version:           1.11.0 (using KDE 4.2.0)
Compiler:          gcc 4.3.3 
OS:                Linux
Installed from:    Gentoo Packages

after upgrading to kde-4.2, my system seems to build up gpgsm programs over time that dont go away.  i never had this problem with kde-3.5, or kde-4.1.[0-4].

every time i send a message, two new `gpgsm --server` instances are spawned.  they never get killed.  while i do have signing of messages turned on by default, disabling it for a message doesnt seem to matter ... gpgsm gets spawned again.

$ ps aux | grep -c gpgsm

with each one sucking up about a meg of RSS, things slowly head south over time.  i have to `killall gpgsm` every few days.

not sure what kind of info is useful here, so i'll just rattle off a few things:
 - gnupg 2.0.9
 - private key for signing is 4096bit RSA
 - my identity has OpenPGP signing key set in crypto tab
 - security->composing has 'automatically sign messages'
 - crypto backends has these two listed:
   - OpenPGP (gpg)
   - S/MIME (gpgsm)
 - both backends were detected automatically and so use default options

here's the output from running:
$ grep -v -e '^$' -e '^#' ~/.gnupg/*.conf
~/.gnupg/dirmngr.conf:debug-level basic
~/.gnupg/dirmngr.conf:log-file socket://~/.gnupg/log-socket
~/.gnupg/gpa.conf:keyserver ldap://pgp.surfnet.nl:11370
~/.gnupg/gpg-agent.conf:pinentry-program /usr/bin/pinentry-dynamic
~/.gnupg/gpg-agent.conf:default-cache-ttl 604800
~/.gnupg/gpg-agent.conf:max-cache-ttl 1209600
~/.gnupg/gpg-agent.conf:debug-level basic
~/.gnupg/gpg-agent.conf:log-file socket://~/.gnupg/log-socket
~/.gnupg/gpg-agent.conf:default-cache-ttl 999999
~/.gnupg/gpg.conf:default-key <mykey>
~/.gnupg/gpg.conf:keyserver hkp://subkeys.pgp.net
~/.gnupg/gpg.conf:keyserver-options timeout=3
~/.gnupg/gpg.conf:keyserver-options auto-key-retrieve
~/.gnupg/gpg.conf:keyserver-options verbose
~/.gnupg/gpg.conf:keyserver-options verbose
~/.gnupg/gpg.conf:keyserver-options verbose
~/.gnupg/gpgsm.conf:debug-level basic
~/.gnupg/gpgsm.conf:log-file socket://~/.gnupg/log-socket
Comment 1 Rex Dieter 2009-06-02 00:14:08 UTC
We've a user seeing this too:
Comment 2 Mike Frysinger 2009-07-22 07:13:49 UTC
i just noticed that the issue seems to be better with kde-4.2.4 ...

at least on my system, it seems to stabilize at a handful of gpgsm instances (like 6 of them), although it'd be nice if there werent any duplicate ones at all
Comment 3 Matt Whitlock 2009-09-03 07:35:52 UTC
I'm so glad other people are seeing this, and it's not just me.  I've been seeing this ever since I upgraded to KDE 4.1.1 from 3.5.10.

Every signed message I view in KMail causes another gpgsm instance to be spawned.

$ pgrep gpgsm | wc -l

There is apparently no practical limit on the number of these things that can be spawned.

I almost never quit KMail, and I do see very few gpgsm instances running sometimes, so I have to guess that they do die off eventually.  Nevertheless, KMail should be telling these things to terminate when it's finished with them, or else it should be reusing them rather than spawning new ones all the time.  Perhaps it's trying to pool and reuse instances and just doing a lousy job?

For what it's worth, they do terminate immediately if I quit KMail.

I'm using KDE 4.3.1 (KMail 1.12.1) built from source by Gentoo's ebuilds.
Comment 4 Mike Frysinger 2009-09-03 15:53:49 UTC
i dont have any gpgsm instances sticking around with kde-4.3.0, so perhaps there is interaction with something else non-obvious here ...
Comment 5 Brian Foster 2009-10-16 12:29:56 UTC
I recently upgraded to Kubuntu 9.04 (yes, I'm a bit slow with
the upgrades!), and am now also seeing this issue.

   $ kmail --version
   Qt: 4.5.0
   KDE: 4.2.2 (KDE 4.2.2)
   KMail: 1.11.2
   $ gpgsm --version
   gpgsm (GnuPG) 2.0.9
   [ ... ]
   Home: ~/.gnupg
   Supported algorithms:
   Pubkey: RSA, ECDSA
   Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, WHIRLPOOL
   Used libraries: gcrypt(1.4.1), ksba(1.0.3), assuan(1.0.5)

I have a huge number of files of the general form (all of which
date from after the upgrade to Kubuntu 9.04):


I do not (knowingly) use gpg/gunpg/whatever-this-is, and have
never (knowingly, or at least that I can recall  ;-\  ) set
it up.  Hence, I presume, everything in  ~/.gnupg/  is default?
Comment 6 Laurent Montel 2015-04-12 10:24:12 UTC
Thank you for taking the time to file a bug report.

KMail2 was released in 2011, and the entire code base went through significant changes. We are currently in the process of porting to Qt5 and KF5. It is unlikely that these bugs are still valid in KMail2.

We welcome you to try out KMail 2 with the KDE 4.14 release and give your feedback.
Comment 7 Kevin Funk 2016-06-01 13:00:42 UTC
Still true under KMail 5 (here: 5.1.3). Confirmed by dfaure & me.
Comment 8 David Faure 2017-04-03 07:01:31 UTC
Git commit 14728b61a24f29afc2b3f8b86c26b410fdc27a0c by David Faure.
Committed on 03/04/2017 at 07:00.
Pushed by dfaure into branch 'Applications/17.04'.

Fix gpgsm processes being leaked due to QGpgME::KeyListJob not being deleted
FIXED-IN: 17.04

M  +2    -1    mimetreeparser/src/viewer/messagepart.cpp