Prompting on concurrent invocations of gpg

Ingo Klöcker kloecker at
Tue Mar 16 19:40:44 CET 2021

On Dienstag, 16. März 2021 12:19:17 CET John Lane wrote:
> Hello, I have a scenario where gpg is prompting for a passphrase when I
> don't think it should because it is cached in the agent. It seems to be
> triggered by concurrent use. Here is an example.
> $ for n in {1..10}; do ( gpg --decrypt test.gpg &> /dev/null;) & done
> This will prompt for the passphrase a number of times. The number of
> iterations can be small, but it seems to start prompting at 6.

Probably the easiest way to avoid this is to seed the cache of gpg-agent with 
the needed passphrases before starting the concurrent invocations. See
man gpg-preset-passphrase
for details.

> Sometimes, not always and only on this concurrent example, I also see a
> memory allocation error (this appears unrelated to the prompting and
> happens after running the test a few times):
>     gpg: public key decryption failed: Cannot allocate memory

That sounds like a bug.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the Gnupg-users mailing list