Page MenuHome GnuPG

gpg.exe gets stuck and piling up
Closed, ResolvedPublic

Description

I am running a powershell script on an windows 2022 server that encrypts and signs .txt files in preparation to send them.
When I execute the script, it works mostly fine, but sometimes the agent gets "stuck" and does not do anything beyond the message (-verbose option in the powershell script) gpg-enabled compatible flags. From there on, nothing hapens.

I tried it with gpg4win, only GnuPG (Versions 2.4.3; 2.4.0) issue is still persistent. I tried a powershell script that loops the process, after 525 tries, it failed. The other run failed after 30 tries.

$gpgProcess = start-process "${env:ProgramFiles(x86)}\gnupg\bin\gpg.exe" -ArgumentList " --homedir C:\Users\username\AppData\Roaming\gnupg --armor --sign --encrypt --verbose --recipient "receipient>" "$zipFile"" -Wait -PassThru -WindowStyle normal -ErrorAction SilentlyContinue

Details

Version
4.2.0

Event Timeline

Are you using the keyboxd - that is, is this a new installation with gpg 2.4.3 or an old installation w/o keyboxd enabled?

Try to serialize your processes - the gpg processes seem to race for the pubring.gpg lock or to start the agent. The next version has an improved lock retry algorithm, but it does not solve the general problem. With the keyboxd you should not have the problem - as long as the keyboxd works as expected. Enable logging for the keyboxd in that case.

You can also try to first launch the gpg-agent: gpgconf --launch gpg-agent

TimS claimed this task.

Hi Werner,
after I enabled more detailed logging, I found that the issue is whithin an "old" file what was encyrpted using an outdated key. Somehow the gpg-agent got stuck here while trying to decrypt the file. After removal of the file the issue is gone, thank you for your input!