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

race condition in code causes creation of more timeseries than requested #6

Closed
sandeepbhojwani opened this issue Apr 17, 2019 · 2 comments

Comments

@sandeepbhojwani
Copy link

Let's say if you run avalanche with the following arguments

     - --metric-count=1
      - --series-count=1
      - --label-count=1
      - --metricname-length=10
      - --labelname-length=10
      - --value-interval=60 # 1 min
      - --series-interval=300 # 5 min
      - --metric-interval=86400 # 1 day

The expectation is that there will be 1 timeseries and every 5 minutes old timeseries will be deleted and a new timeseries will be created. However, due to a race condition in the code, new timeseries will be created and old timeseries will be kept.

The race condition is between the goroutine for value tick and series tick. On the 5th minute, both will fire and create a race condition because series goroutine does 3 things which may interleave with the work that value goroutine does.

One way to fix the race condition will be to not use 3 goroutines but instead use a select.

@csmarchbanks
Copy link
Contributor

Thank you for raising this issue! Would you like to create a PR to fix the issue?

If not I will look into it soon.

@csmarchbanks
Copy link
Contributor

This has been fixed by the mutex added in #8.

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

No branches or pull requests

2 participants