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

Deadlock case LPWriter.Write #31

Closed
GeorgeMac opened this issue Jul 12, 2019 · 1 comment
Closed

Deadlock case LPWriter.Write #31

GeorgeMac opened this issue Jul 12, 2019 · 1 comment
Assignees
Labels
bug Something isn't working team/compute

Comments

@GeorgeMac
Copy link
Contributor

GeorgeMac commented Jul 12, 2019

see:

w.lock.Lock()
i, err := w.enc.Write(name, ts, tagKeys, tagVals, fieldKeys, fieldVals)
// asyncronously flush if the size of the buffer is too big.
if err != nil {
return i, err
}
w.asyncFlush()
w.lock.Unlock()

Either this Unlock needs to be defered or Unlock needs to be called at all return points in this function. Otherwise we will cause a deadlock.

Same goes for WriteMetrics:

w.lock.Lock()
for i := range m {
j, err := w.enc.Encode(m[i])
if err != nil {
return j, err
}
}
w.asyncFlush()
w.lock.Unlock()

@GeorgeMac GeorgeMac added the bug Something isn't working label Jul 12, 2019
@GeorgeMac GeorgeMac self-assigned this Aug 1, 2019
@GeorgeMac
Copy link
Contributor Author

Delivered in #28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working team/compute
Projects
None yet
Development

No branches or pull requests

2 participants