Do not reuse the curl handle across a fork - #643
Open
dutow wants to merge 1 commit into
Open
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release-2.2 #643 +/- ##
==============================================
Coverage ? 56.69%
==============================================
Files ? 71
Lines ? 11237
Branches ? 2778
==============================================
Hits ? 6371
Misses ? 3501
Partials ? 1365
🚀 New features to boost your workflow:
|
jeltz
approved these changes
Jul 28, 2026
jeltz
left a comment
Collaborator
There was a problem hiding this comment.
Looks good, but maybe we should merge it into release-2.2 and update our release notes.
The postmaster does keyring requests while generating the WAL key, so keyringCurl and its keepalive socket get inherited by every child. Two processes then interleave HTTP on the same connection, which surfaces as CURLE_WEIRD_SERVER_REPLY, a timeout, or a garbled response body. Re-init the handle when the pid changed. The inherited handle is abandoned instead of cleaned up, because curl_easy_cleanup would write a TLS shutdown to the connection the parent still uses.
Collaborator
Author
|
@jeltz updated |
Andriciuc
reviewed
Jul 28, 2026
| ### Bug Fixes | ||
|
|
||
| - [PG-2492](https://perconadev.atlassian.net/browse/PG-2492) - Fixed crash when empty certificate parameters are passed to `pg_tde_add_global_key_provider_kmip()` or `pg_tde_add_database_key_provider_kmip()` | ||
| - [PG-2608](https://perconadev.atlassian.net/browse/PG-2608) - Fix race condition in Vault key provider |
Collaborator
There was a problem hiding this comment.
Slightly more descriptive:
Fixed a race condition in the Vault key provider that could occur when multiple processes accessed the same cURL handle after a fork.
LGTM!
Collaborator
|
Looks good to me. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The postmaster does keyring requests while generating the WAL key, so keyringCurl and its keepalive socket get inherited by every child. Two processes then interleave HTTP on the same connection, which surfaces as CURLE_WEIRD_SERVER_REPLY, a timeout, or a garbled response body.
Re-init the handle when the pid changed. The inherited handle is abandoned instead of cleaned up, because curl_easy_cleanup would write a TLS shutdown to the connection the parent still uses.