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

Fix agent logging race #2578

Merged
merged 1 commit into from
Mar 28, 2018
Merged

Fix agent logging race #2578

merged 1 commit into from
Mar 28, 2018

Conversation

cyli
Copy link
Contributor

@cyli cyli commented Mar 28, 2018

Add an ID function to StatusReporter, so we can better log what reporter failed.

Granted, this is a lot of extra changes to fix this problematic line: https://github.com/docker/swarmkit/compare/master...cyli:fix-agent-data-race?expand=1#diff-689e5cbc4a9f04fda8f8cd9749d87db7L438.

We could just take out the reporting on which reporter failed instead, and that would be shorter. But since we've been having trouble debugging live logs, I thought more information would be more useful than less.

Fixes #2576

@stevvooe
Copy link
Contributor

@cyli I would have just removed the reporter from the log line. Is there any value in know which reporter is causing the issue? Do you have an example log line with this patch?

}

type statusReporterFunc func(ctx context.Context, taskID string, status *api.TaskStatus) error
type statusReporterFunc struct {
function func(ctx context.Context, taskID string, status *api.TaskStatus) error
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is pretty ugly. :| But the alternative is to always report "anonymous function". In reality, we only use this (not in tests) in one place, and that is an anonymous function for reporting on a single task.

@cyli
Copy link
Contributor Author

cyli commented Mar 28, 2018

@stevvooe I'm not sure if there is any value, except that maybe we could correlate the failed report with a particular task getting stuck. Probably just taking out the reporter would be better though. This is a pretty ugly way to get the info.

…ata race.

Signed-off-by: Ying Li <ying.li@docker.com>
@codecov
Copy link

codecov bot commented Mar 28, 2018

Codecov Report

Merging #2578 into master will decrease coverage by 0.07%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #2578      +/-   ##
==========================================
- Coverage   61.42%   61.34%   -0.08%     
==========================================
  Files         134      134              
  Lines       21722    21722              
==========================================
- Hits        13342    13325      -17     
- Misses       6945     6964      +19     
+ Partials     1435     1433       -2

@stevvooe
Copy link
Contributor

@cyli Agreed. Let's go with the simple option here. Thanks for exploring the problem space!

@stevvooe
Copy link
Contributor

LGTM

@cyli
Copy link
Contributor Author

cyli commented Mar 28, 2018

@stevvooe Thanks for finding the problematic line! :D

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.

Data race in agent logging
3 participants