Uploaded image for project: 'Commons VFS'
  1. Commons VFS
  2. VFS-487

File creation events missed when deleted then re-created within poll delay

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.1
    • Labels:
      None

      Description

      To reproduce:

      • create a file monitor and add a directory with at least one child file
      • set delay to 5 seconds and start the monitor
      • delete a child file, wait for monitor to detect deletion
      • re-create the child file within 5 seconds
      • creation event is not detected

      This is mainly due to this block being at the start of the main loop instead of the end:

                  while (!this.deleteStack.empty())
                  {
                      this.removeFile(this.deleteStack.pop());
                  }
      

      When this is executed the file is in the stack from the previous poll and the file has already been re-created. removeFile calls FileMonitorAgent#resetChildrenList which updates the children list for that agent (which will contain the newly created file), but doesn't update the monitor map. The subsequent call to FileMonitorAgent#check in the main loop then doesn't detect the new file.

      Moving the above block to the end of the main loop would prevent most occurrences of this issue, but the implementation is still racy.

        Attachments

        1. VFS-487.patch
          3 kB
          Ryan Leary
        2. VFS-487-2.patch
          2 kB
          Dave Marion

          Issue Links

            Activity

              People

              • Assignee:
                b.eckenfels Bernd Eckenfels
                Reporter:
                shaldane Sam Haldane
              • Votes:
                5 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: