Limit active connections for gpg-agent
Needs ReviewPublic

Authored by gniibe on Dec 17 2018, 2:46 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

For the issue like T4255: gpg-agent: "<gcrypt> Cannot allocate memory" with 10 threads decrypting OpenPGP, it might be worth to limit number of active connections (to let wait clients) of gpg-agent.
Since feature like this is racy, we need to review the changes carefully.
And we also need to consider adding event to wake up on Windows.
Besides, we need to consider putty support on Windows.

Test Plan

Diff Detail

Repository
rG GnuPG
Lint
Lint Skipped
Unit
Unit Tests Skipped
gniibe created this revision.Dec 17 2018, 2:46 AM

This is an experimental patch. So, I just reuse SIGUSR1 to wake up "select"-ing thread by kill(2).
I put limit-active-connections 2 in gpg-agent.conf for the test with run-threaded of gpgme.

gniibe updated this revision to Diff 1352.Dec 17 2018, 3:54 AM

increment the counter is better done by the looping main thread.

werner added a subscriber: werner.Dec 17 2018, 9:49 AM

I don't think that this is a good solution for a problem we could solve much easier but fear to do that due to kind of crypto politics.