-
Notifications
You must be signed in to change notification settings - Fork 788
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
Guard access to Target.{frames,cur} globally #1111
Conversation
@WalkerGriggs Good catch! Thank you very much! How did you find the issue? Is it possible to add a regress test for this issue? It's good to have one. But it's also okay to submit the fix without a regress test if it's hard/impossible to write the test. |
The failed check is due to #1105, we can ignore it here. BTW, can you change the commit message to |
@ZekeLu, we're not entirely sure. I can spend more time digging tomorrow if that's valuable information. My best guess is overlapping calls to Spitballing here, but could two main event loops run in parallel if WRT changing commit message: certainly can |
Please do digging more so that we can understand the issue better. Can you run your app with the
I'm not sure what will happen in this case, but I think we should avoid doing it. Is there a use case that you need to call |
Can do. This is part of a system that has been running for months (maybe years now), and this is the first occurrence. We've dumped the goroutines when it panicked, so maybe that'll reveal something.
Maybe, but unlikely.
Oh, we avoid that; no use case here. Just throwing out some ideas, though probably not useful until we narrow things down. |
@ZekeLu -- following up on this. We just ran into this same issue again. I would like to rebase to the latest master and merge this change in if possible. |
Do you have more information to share this time?
I just took a quick look. There are only 3 map writes: Lines 298 to 305 in 1738691
Lines 345 to 354 in 1738691
Lines 290 to 298 in 1738691
The first 2 writes are in the If this is the case, we should add a write lock here too. I think it's possible to write a test for this case. Would you like to give it a try? BTW, the write in |
@ZekeLu, unfortunately not enough to confidently reproduce this specific error case in tests. The stack traces are thin at best, and these rare occurrences are causing issues in production. Locking the frame read when there's the risk of concurrent access feels like a quick win here.
We do use
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should take the changes from #1297 too.
And if you don't mind, please fix other minor issues related frameMu
listed below:
- it seems that a read lock is enough:
Lines 622 to 624 in 0b936bf
c.Target.frameMu.Lock() | |
frameID = c.Target.cur | |
c.Target.frameMu.Unlock() |
// frameMu protects frames, execContexts, and cur.
Line 31 in 0b936bf
// frameMu protects both frames and cur.
@ZekeLu I noticed you've triggered the tests few times which all leak a similar temp dir. I ran the tests locally with the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's another known issue tracking by #1105. We can ignore the error here.
Thank you @WalkerGriggs, @xiusin and @alexandear!
domEvent
with a read lock
Some accesses to
Target.frames
andTarget.cur
are not guarded byTarget.frameMu
unintentionally. Which leads to data race.Fixes: #1110
Fixes: #1296