Commit 53a7adb
fix(profiling): skip system cert loading for non-HTTPS endpoints
Since 9a61cae (perf(profiling): cache TLS in ProfileExporter::new,
2026-02-27), TLS configuration is initialized unconditionally in
ProfileExporter::new(), even when the endpoint uses plain HTTP (e.g.
agent mode at http://<host>:8126), unix sockets, or named pipes.
There are two layers to the problem:
1. Our cached_tls_config() calls rustls-platform-verifier which eagerly
loads the system CA store on Linux.
2. Even without our call, reqwest::ClientBuilder::build() also attempts
to initialize its own TLS backend (loading system certs) unless a
preconfigured TLS config is provided.
Both fail with the same error in minimal container images (e.g. bare
ubuntu:20.04 without the ca-certificates package):
failed to initialize TLS configuration: unexpected error:
No CA certificates were loaded from the system
This surfaced in ddprof after the libdatadog v29 upgrade: the profiler
targets the Datadog agent over HTTP and has no reason to touch the cert
store at all.
Fix:
- For HTTPS endpoints, use the existing cached platform TLS config
(loads system CA certs via rustls-platform-verifier).
- For all other schemes (http, unix, windows, file), provide reqwest
with a minimal TLS config that has an empty root store. This prevents
reqwest from loading system certs itself, while still giving it a
valid TLS backend. TLS is never negotiated on these transports anyway.
Verified with a Docker repro: ubuntu:22.04 after
`dpkg --force-depends --purge ca-certificates`, all 5 exporter_e2e
tests pass with the fix and fail without it.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent db9b9f4 commit 53a7adb
2 files changed
Lines changed: 36 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
82 | 91 | | |
83 | 92 | | |
84 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
72 | 92 | | |
73 | 93 | | |
74 | 94 | | |
| |||
80 | 100 | | |
81 | 101 | | |
82 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
0 commit comments