Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the AnyEvent-Filesys-Notify CPAN distribution.

Report information
The Basics
Id: 82848
Status: open
Priority: 0/
Queue: AnyEvent-Filesys-Notify

People
Owner: mgrimes [...] cpan.org
Requestors: cpan [...] wellrounded.com
Cc: mgrimes [...] cpan.org
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.19
Fixed in: (no value)



CC: mgrimes [...] cpan.org
Subject: failure to capture inotify "IN_CLOSE_WRITE" events
It is crucial to be able to trigger AnyEvent when a file has been COMPLETELY written. Only at that point, in many applications, is the file ready to be read. The AEFN::Event model captures only three event types: create, modify, and delete. These are inadequate for the use case above. All three of these event types get triggered at other times, but not when a series of writes has been COMPLETED. Normally, the file-completion event is captured via inotify by monitoring the IN_CLOSE_WRITE event, which triggers when a file opened for writing is finally closed. Can you please augment the AEFN::Event model to capture the inotify event types that are missing? In particular, would you please add a "close_write" event type to AEFN::Event. Thank you.
Jonathan, Thanks for the RT report. I understand the issue you are experiencing and can see why the IN_CLOSE_WRITE event might work better for you than the current events. On the other hand, AEFN is meant to provide a cross platform solution to watching a file system under AnyEvent. None of the other backend implementations (KQueue, FSEvent nor a dumb scan of the directory tree) support the a written and closed event (as far as I can tell). Having AEFN fire off different events depending on the backend seems like an invitation for confusion and bugs. That siad, I have been considering exposing the flags passed to Inotify's watch() and KQueue's EV_SET(). If that were the case, you could then replace the IN_MODIFY flag with IN_CLOSE_WRITE. You would then get a "modified" event only when the file is written and closed. No event would be received when the file is written but left open. Would that be an adequate solution for your purposes? Thanks, Mark On Mon Jan 21 04:13:51 2013, JAM wrote: Show quoted text
> It is crucial to be able to trigger AnyEvent when a file has been > COMPLETELY written. Only at that point, in many applications, is the > file ready to be read. > > The AEFN::Event model captures only three event types: create, modify, > and delete. These are inadequate for the use case above. All three of > these event types get triggered at other times, but not when a series of > writes has been COMPLETED. > > Normally, the file-completion event is captured via inotify by > monitoring the IN_CLOSE_WRITE event, which triggers when a file opened > for writing is finally closed. > > Can you please augment the AEFN::Event model to capture the inotify > event types that are missing? In particular, would you please add a > "close_write" event type to AEFN::Event. > > Thank you.