-
Notifications
You must be signed in to change notification settings - Fork 181
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 during call to ShapeIndex.Iterator() #67
Comments
Can you see if 050ea44 fixes this? If not, can you provide a reproduction case? |
I can check |
Problem still persists. To reproduce it is pretty simple:
I'll provide full code later, I'm at work now. PS: I really don't think any of the recent changes fix this because the call chain that I described originally remains a valid execution path. |
You are adding the same shape a second time to the index?
…On Thu, Jul 30, 2020 at 6:31 AM Gastón Haro ***@***.***> wrote:
Problem still persists. To reproduce it is pretty simple:
index := s2.NewShapeIndex()
loop := s2.LoopFromPoints(points)
index.Add(loop)
index.Build()
other_loop := s2.LoopFromPoints(other_points)
index.Add(other_loop)
index.Add(loop)
index.Build() // Deadlock
I'll provide full code later, I'm at work now.
(I'm not sure if this is dependant on the shapes themselves yet)
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub
<#67 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACBHGBBVS24MBPWVBHOHE3TR6FY2FANCNFSM4OV6WWUA>
.
|
No, new (and different) shapes. |
I'm running into this issue as well: github.com/golang/geo/s2.(*ShapeIndex).maybeApplyUpdates(0xc0001903f0) Even after patching the library to return an iterator without locking in the maybeApplyUpdates code path, Begin()-shapeindex.go:650 calls maybeApplyUpdates which will also cause a deadlock. I'm open to submitting a fix, but it's not clear to me the best path forward. There's a TODO for replacing the mutex, so perhaps there's a planned update that will address this issue. |
Sorry I haven't found time to submit a minimal working example to reproduce the bug, but the way to go is pretty clear. Even by doing code inspection you realize the possibility of deadlock. |
After quickly looking at this issue because I got hit by it myself, I found out that solving this is a bit more effort than just avoiding the deadlock: Subsequent calls to Build (or anything that triggers an update) may trigger a call to Lines 537 to 540 in 740aa86
But looking at the original C++ source code, it shouldn't be too hard to port it (?): |
This is the call chain for (s *ShapeIndex)
I'm using version v0.0.0-20200319012246-673a6f80352d
The text was updated successfully, but these errors were encountered: