-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Signing with gpg must be done serially to avoid gpg-agent running out of memory #168
Comments
Would this go away if you set useGpgAgent := false given |
From the gpg manpage on my system:
So I'm going to guess no. |
In 54266c1 I upgraded sbt-pgp from 1.1.0 to 2.0.0-M2, this changed the way signing was done: instead of using the bouncycastle Java library, sbt-pgp now just calls gpg. Unfortunately, it turns out that multiple parallel calls to gpg can lead to the gpg-agent running out of memory, causing `publishSigned` to fai, as happened in https://dotty-ci.epfl.ch/lampepfl/dotty/1487/1/8 while trying to publish Dotty 0.19.0-RC1: gpg: signing failed: Cannot allocate memory I've opened an issue at sbt/sbt-pgp#168, but meanwhile this is fixed by reverting back to using bouncycastle by setting SBT_PGP_USE_GPG=0 as documented in the README of sbt-pgp.
In 54266c1 I upgraded sbt-pgp from 1.1.0 to 2.0.0-M2, this changed the way signing was done: instead of using the bouncycastle Java library, sbt-pgp now just calls gpg. Unfortunately, it turns out that multiple parallel calls to gpg can lead to the gpg-agent running out of memory, causing `publishSigned` to fai, as happened in https://dotty-ci.epfl.ch/lampepfl/dotty/1487/1/8 while trying to publish Dotty 0.19.0-RC1: gpg: signing failed: Cannot allocate memory I've opened an issue at sbt/sbt-pgp#168, but meanwhile this is fixed by reverting back to using bouncycastle by setting -DSBT_PGP_USE_GPG=false.
In 54266c1 I upgraded sbt-pgp from 1.1.0 to 2.0.0-M2, this changed the way signing was done: instead of using the bouncycastle Java library, sbt-pgp now just calls gpg. Unfortunately, it turns out that multiple parallel calls to gpg can lead to the gpg-agent running out of memory, causing `publishSigned` to fai, as happened in https://dotty-ci.epfl.ch/lampepfl/dotty/1487/1/8 while trying to publish Dotty 0.19.0-RC1: gpg: signing failed: Cannot allocate memory I've opened an issue at sbt/sbt-pgp#168, but meanwhile this is fixed by reverting back to using bouncycastle by setting -DSBT_PGP_USE_GPG=false.
Do you know what is the degree of parallelism here that causes the issue? Is it anything more than 1 or 16? |
It happened when publishing dotty which is maybe 8 modules, but it's going to depend on a bunch of things like what is being signed and what parameters gpg-agent is using. So the most conservative thing to do is to be serial. |
ok. @debasishg said he's hitting it too with a 16 subproject project. |
My suggestion is to fix sbt-pgp, or to switch back to making it use bouncycastle (beware, the README instructions for doing that are incorrect, see #169). |
Here's my PR - #171 |
## Description Changing the concurrency (reducing it from thread per core to half thread per core) reduces the memory pressure on GPG and allows the release dry run to succeed. Success run: https://github.com/camunda/zeebe/actions/runs/8690933557 Found related issue in another project: Related issue sbt/sbt-pgp#168 After merging this we should try to enable the dry run again. ## Related issues related #17435
## Description Changing the concurrency (reducing it from thread per core to half thread per core) reduces the memory pressure on GPG and allows the release dry run to succeed. Success run: https://github.com/camunda/zeebe/actions/runs/8690933557 Found related issue in another project: Related issue sbt/sbt-pgp#168 After merging this we should try to enable the dry run again. ## Related issues related #17435
When running
publishSigned
on aggregated projects, we might end up calling gpg multiple times in parallel, this can lead to the gpg-agent running out of "secmem" (secure memory) (see https://dev.gnupg.org/T4255) which can manifest itself with errors such as:(as usual with gpg, this error is very confusing: the system didn't run out of memory at all). This isn't just a theoretical concern, this is currently blocking the release of Dotty 0.19.0-RC1: https://dotty-ci.epfl.ch/lampepfl/dotty/1487/1/8
To fix this, an option
auto-expand-secmem
was added to gpg-agent.conf (https://dev.gnupg.org/T3530), according to that PR:Unfortunately, Ubuntu 18.04 uses libgcrypt 1.8.1, so this fix isn't usable on a lot of CI setups.
Therefore it seems like the only sane thing to do for sbt-pgp is to wrap calls to gpg into a
synchronized
block to make sure they're never executed in parallel.The text was updated successfully, but these errors were encountered: