-
Notifications
You must be signed in to change notification settings - Fork 52
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
File modification events are getting lost in PollingWatchService #86
Comments
Thank you for the insight @mechkg, I'll look into what you've found (it works well with sbt/sbt#3687, sbt/sbt#3695, #82, and sbt/sbt#3775 which I'm look at). |
In
So keysWithEvents is being modified by |
Simply removing this line:
apparently makes the problem go away. It looks like it is not necessary because |
Fixes #86 which means Fixes sbt/sbt#3687 Fixes sbt/sbt#3695 Fixes sbt/sbt#3775
Fixed with #90. |
While investigating sbt/sbt#3775 I think I have narrowed the bug down to the interaction between
PollingWatchService.pollEvents
andPollingWatchService.PollingThread.addEvent
.Events often get lost without being properly consumed (#82 is probably related).
UPDATE: the conclusion below is wrong, see comments further down.
As far as I understand the only reason that could happen is if some events get added between these two statements:
io/io/src/main/scala/sbt/io/PollingWatchService.scala
Lines 61 to 64 in e8c9757
so
thread.keysWithEvents.clear
deletes events that weren't consumed. This should be prevented by thesynchronized
guard.It is difficult to set up my own modified sbt build to properly test this but at a glance I find this line suspicious:
io/io/src/main/scala/sbt/io/PollingWatchService.scala
Line 105 in e8c9757
I don't understand the purpose of the
notifyAll
call at this point and I suspect that it could break the intended synchronization behaviour.The text was updated successfully, but these errors were encountered: