Opened 12 years ago
Last modified 9 years ago
#1687 new defect
[PATCH] Hotloading fails if FAMCreated and FAMDeleted events occur in same polling
Reported by: | historic_bruno | Owned by: | |
---|---|---|---|
Priority: | Should Have | Milestone: | Backlog |
Component: | Core engine | Keywords: | patch |
Cc: | Patch: |
Description (last modified by )
While troubleshooting hotloading/FAM on Ubuntu 12.04, I noticed that editing a GUI page in gedit was not triggering correct hotloading behavior - for some reason it was ignoring the FAM events. Using gdb I found the following sequence of events in a single call to dir_watch_Poll():
Created /home/ben/0ad/binaries/data/mods/public/gui/pregame/.goutputstream-HV66KW Changed /home/ben/0ad/binaries/data/mods/public/gui/pregame/.goutputstream-HV66KW Created /home/ben/0ad/binaries/data/mods/public/gui/pregame/mainmenu.xml~ Deleted /home/ben/0ad/binaries/data/mods/public/gui/pregame/.goutputstream-HV66KW Created /home/ben/0ad/binaries/data/mods/public/gui/pregame/mainmenu.xml
I believe the bug occurs when the temporary file .goutputstream-HV66KW
is created and deleted between calls to dir_watch_Poll()
. By the time the notification is processed, the file has already been deleted. When ReloadChangedFiles() tries to remove the file from VFS, it silently fails and all further notifications from that polling are lost. The change to mainmenu.xml
occurs last and is never processed.
If instead I directly overwrite mainmenu.xml
with another file, hotloading works as expected.
I will also test with #1316 but I suspect the bug will still exist since it's a higher level issue in ReloadChangedFiles()
.
Attachments (1)
Change History (13)
comment:1 by , 12 years ago
Description: | modified (diff) |
---|
comment:2 by , 12 years ago
Description: | modified (diff) |
---|
comment:4 by , 11 years ago
Shouldn't merging (or rather dropping) all messages for one file suffice?
I decided to give it a try, but I couldn't even get any feedback (not even a print statement in dir_watch_add gave something back...).
comment:5 by , 11 years ago
As I've been touching that code (or rather code related to it) recently I wondered why we are using RETURN_STATUS_IF_ERR()
in there instead of just logging errors and calling continue
which would remove this issue. Also I'd be for relaxing the check when removing to allow both INFO::OK
and ERR::VFS_FILE_NOT_FOUND
to make addition of new files use the same code path.
(Note to adding files: The current code is a bit broken in regard to this currently as adding a file will be ignored, but changing it will trigger the file to show up, so callers already have to check for additions of new files (if they don't want to support it))
comment:6 by , 11 years ago
Keywords: | patch review added |
---|---|
Milestone: | Backlog → Alpha 15 |
comment:7 by , 11 years ago
Summary: | Hotloading fails if FAMCreated and FAMDeleted events occur in same polling → [PATCH] Hotloading fails if FAMCreated and FAMDeleted events occur in same polling |
---|
comment:8 by , 10 years ago
Milestone: | Alpha 15 → Alpha 16 |
---|
comment:9 by , 10 years ago
Milestone: | Alpha 16 → Alpha 17 |
---|
comment:10 by , 10 years ago
Milestone: | Alpha 17 → Alpha 18 |
---|
comment:11 by , 9 years ago
Milestone: | Alpha 18 → Alpha 19 |
---|
comment:12 by , 9 years ago
Keywords: | review removed |
---|---|
Milestone: | Alpha 19 → Backlog |
Above patch doesn't apply cleanly anymore. I do have an updated but untested version around somewhere, but for now this isn't really up for review.
Confirmed that the bug still occurs with the inotify patch from #1316 (though the events are slightly different).