patch: minimize calls to close() in spawn by calling poll()

Casey Tucker dctucker at
Sat Nov 17 01:57:13 CET 2018


Posting this patch to the mailing list per jeroen's instructions.

# Problem Statement
When running GPGME within Docker, the maximum number of FDs may be set
higher than a sane and reasonable values for its specific use-case, causing
many close calls to be issued, introducing a major slowdown in performance
of any calls to the `gpg` binary.

# Proposed Solution
This PR attempts to mitigate the problem by calling `poll` on the entire
range of file descriptors before issuing `close` calls to each file
descriptor. This limits the number of close calls made to the number of
active file descriptors in the current process. It also includes a minor

## Performance before and after

This graph shows the performance of an application signing and then
decrypting a few kilobytes of data.

# The patch
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Gnupg-devel mailing list