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: Data races detected from Batch function #448 #449

Merged
merged 5 commits into from
Sep 3, 2020
Merged

fix: Data races detected from Batch function #448 #449

merged 5 commits into from
Sep 3, 2020

Conversation

judehung
Copy link
Member

@judehung judehung commented Aug 17, 2020

After analyzing those data races as listed in #448, there're two
variables shall be in atomic operation to avoid data races:

  1. batchData
  2. timerActive

This commit from the batchData [][]byte to atomicBatchData to avoid data
race and update timerActive from bool to atomicBool to avoid data race

Signed-off-by: Jude Hung [email protected]

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

12 data races are detected from batch function
Issue Number:
#448

What is the new behavior?

Clean up all these data races detected from batch function

Does this PR introduce a breaking change?

  • Yes
  • No

Are there any new imports or modules? If so, what are they used for and why?

Are there any specific instructions or things that should be known prior to reviewing?

https://golang.org/doc/articles/race_detector.html#:~:text=A%20data%20race%20occurs%20when,Go%20Memory%20Model%20for%20details.

Other information

After analyzing those data races as listed in #448, there're two
variables shall be in atomic operation to avoid data races:

1. batchData
2. timerActive

This commit from the batchData [][]byte to atomicBatchData to avoid data
race and update timerActive from bool to atomicBool to avoid data race

Signed-off-by: Jude Hung <[email protected]>
@lenny-goodell lenny-goodell linked an issue Aug 17, 2020 that may be closed by this pull request
Copy link
Member

@lenny-goodell lenny-goodell left a comment

Choose a reason for hiding this comment

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

Looks good. Need @rsdmike to also take a look.

@rsdmike
Copy link
Member

rsdmike commented Aug 26, 2020

recheck

@rsdmike
Copy link
Member

rsdmike commented Aug 26, 2020

The first time this job ran -- we saw the same issue with a race condition on the ARM platform so I'm not convinced it has fixed anything. Running it again it passed. I'd like to run the job a couple more times on this PR and monitor the stability of it the pass rate.

@cloudxxx8
Copy link
Member

@rsdmike if using batch function in the pipeline, the system would run out of memory in couple hours.
with this fix, we have verified it can stand more than one week.
I suggest to merge this PR first and keep the issue open for further investigation. At least we can make this function usable.

@cloudxxx8
Copy link
Member

@judehung please rebase

@lenny-goodell lenny-goodell merged commit 337bfa7 into edgexfoundry:master Sep 3, 2020
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 races detected from Batch function
4 participants