pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/DataDog/datadog-agent/pull/46860

ub.githubassets.com/assets/actions-109fb3a41bacb1c2.css" /> AGTMETRICS-485 Fix logic races in the forwarder. by vickenty · Pull Request #46860 · DataDog/datadog-agent · GitHub
Skip to content

AGTMETRICS-485 Fix logic races in the forwarder.#46860

Draft
vickenty wants to merge 4 commits intomainfrom
vickenty/fsl
Draft

AGTMETRICS-485 Fix logic races in the forwarder.#46860
vickenty wants to merge 4 commits intomainfrom
vickenty/fsl

Conversation

@vickenty
Copy link
Contributor

What does this PR do?

sendHTTPTransactions was insufficiently synchronized and could panic if transactions were submitted while the forwarder was beging stopped. It could access domainForwarders after it has been cleared, causing a nil-dereference panic, or send transaction to a domain forwarder whose channel was closed, causing a 'send on closed channel' panic.

This PR makes sendHTTPTransactions acquire the same mutex used in Start and Stop, preventing it from accessing stale data. This is not expected to increase contention, since sendHTTPTransactions also acquired another exclusive mutex few lines later, which is now redundant and was removed. Internal state was downgraded from atomic to a regular field, since all accesses are now synchronized.

Motivation

Fix a rare crash on shutdown in Otel agent.

Describe how you validated your changes

Unit and e2e tests.

Additional Notes

sendHTTPTransactions reads domainForwarders field, which is replaced
with an empty map at the end of Stop. Atomic read of internalState is
not sufficent to prevent that, Stop may occur between the check and
the read from domainForwarders. Proceeding to send transaction then
results in a nil panic.
f.m is now locked for the duration of sendHTTPTransactions and will
prevent concurrent access to queueDurationCapacity field.
Forwarder state transitions are now fully synchronized by f.m, which
makes the use of atomic for internalState field unnecessary.
@vickenty vickenty added the qa/done QA done before merge and regressions are covered by tests label Feb 24, 2026
@github-actions github-actions bot added the medium review PR review might take time label Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Identify a non-fork PR medium review PR review might take time qa/done QA done before merge and regressions are covered by tests team/agent-metric-pipelines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy