Skip to content

fix(curl): statically initialize linked function table - #2015

Open
jpnurmi wants to merge 2 commits into
masterfrom
jpnurmi/fix/curl-load
Open

fix(curl): statically initialize linked function table#2015
jpnurmi wants to merge 2 commits into
masterfrom
jpnurmi/fix/curl-load

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Initialize the linked function table at compile time and make it immutable.

The linked curl path populated g_curl on every SDK initialization. Options can outlive sentry_close() through references held by telemetry producers, allowing a previous curl client to be freed concurrently with the next initialization. This raced teardown reads of easy_cleanup and global_cleanup against writes to the same function pointers:

The runtime-loaded path is not subject to this race. After its first successful symbol resolution, g_curl.handle remains set for the process lifetime, so later initializations return without rewriting the table. Resolution failures occur before a client can use the resolved entries.

The linked curl path populated g_curl on every SDK initialization. Options can
outlive sentry_close() through references held by telemetry producers, allowing
a previous curl client to be freed concurrently with the next initialization.
This raced teardown reads of easy_cleanup and global_cleanup against writes to
the same function pointers.

Initialize the linked table at compile time and make it immutable.

The runtime-loaded path is not subject to this race. After its first successful
symbol resolution, g_curl.handle remains set for the process lifetime, so later
initializations return without rewriting the table. Resolution failures occur
before a client can use the resolved entries.
@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.34%. Comparing base (51540b3) to head (299e8a9).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2015      +/-   ##
==========================================
+ Coverage   74.32%   74.34%   +0.02%     
==========================================
  Files         104      104              
  Lines       26477    26465      -12     
  Branches     4821     4821              
==========================================
- Hits        19679    19676       -3     
+ Misses       5456     5437      -19     
- Partials     1342     1352      +10     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jpnurmi
jpnurmi requested a review from limbonaut August 24, 2026 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant