gpgme_cancel() does not stop gpg process from finishing asynchronous call

Marcus Brinkmann marcus.brinkmann at
Thu Apr 14 10:14:06 CEST 2005

At Tue, 29 Mar 2005 18:51:11 -0500,
Igor Belyi <gpgme at> wrote:
> [1  <text/plain; ISO-8859-1 (7bit)>]
> Starting asynchronouse call and then canceling it with gpgme_cancel do cause gpgme_wait() return Canceled error but leaves gpg process working and finishing the call. I have a slightly modified t-genkey test which shows that the key is generated after cancelation. I can send it if you want to.

This is true.  We use a double-fork technique to separate the child
from the parent process and then just close all file descriptors.
> I also have a patch (attached, since it's very small) fixing the problem in GPGME 1.0.2. :)

The waitpid is wrong, because GPGME is not the parent of the process
(due to the double-fork).

FOr most operations, current behaviour should be OK.  Even for genkey:
GnuPG is supposed to send a heart-beat every second, so it should
notice that the status FD is closed within the next second and then go
away.  Maybe the current GnuPG versions don't do this, but they should.
Maybe you want to check that one out?


More information about the Gnupg-devel mailing list