Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick #12743 to 7.3: Fix race condition on error returned after context cancellation #12849

Merged
merged 1 commit into from
Jul 11, 2019

Conversation

jsoriano
Copy link
Member

Cherry-pick of PR #12743 to 7.3 branch. Original message:

After #11981 docker client watching event uses the context provided by
the metricset wrapper. This produces a race condition on error
reporting: the errors channel will receive a context cancelled error when
the context is done, so both paths can be chosen by the select. If the
errors one is chosen, an error will be reported and a reconnect will be
attempted, that will fail.

Alternativelly we could have created another context and cancel it after
the reporter is done, in a similar fashion to what was done before #11981,
but then we would be breaking the chain of derived contexts.

Fixing it this way at least by now to avoid the flaking errors that this
is causing.

…tic#12743)

After elastic#11981 docker client watching event uses the context provided by
the metricset wrapper. This produces a race condition on error
reporting: the errors channel will receive a context cancelled error when
the context is done, so both paths can be chosen by the select. If the
errors one is chosen, an error will be reported and a reconnect will be
attempted, that will fail.

Alternativelly we could have created another context and cancel it after
the reporter is done, in a similar fashion to what was done before elastic#11981,
but then we would be breaking the chain of derived contexts.

(cherry picked from commit d36878a)
@jsoriano jsoriano merged commit ce8c90d into elastic:7.3 Jul 11, 2019
leweafan pushed a commit to leweafan/beats that referenced this pull request Apr 28, 2023
…tic#12743) (elastic#12849)

After elastic#11981 docker client watching event uses the context provided by
the metricset wrapper. This produces a race condition on error
reporting: the errors channel will receive a context cancelled error when
the context is done, so both paths can be chosen by the select. If the
errors one is chosen, an error will be reported and a reconnect will be
attempted, that will fail.

Alternativelly we could have created another context and cancel it after
the reporter is done, in a similar fashion to what was done before elastic#11981,
but then we would be breaking the chain of derived contexts.

(cherry picked from commit fcedb16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants