in reply to Random script crashes related to File::Copy

What does your script do to ensure the file being put into the folder is completely copied there?

Possibly, you are trying to move the file out before the creating process finishes writing the file. Not that the error you are getting, ETXTBSY, hint that this is the case. Neither does ETXBSY hint at a reasonable cause based on your description.

Perhaps moving the file out before it has been fully written is part of your current problem. Even if not, your description hints that this may be an issue. See Check whether a file is open for a discussion of the problem.


Be Appropriate && Follow Your Curiosity
  • Comment on Re: Random script crashes related to File::Copy

Replies are listed 'Best First'.
Re^2: Random script crashes related to File::Copy
by michael.barnes (Novice) on Apr 29, 2009 at 21:15 UTC

    Since I am using the move() function from the File::Copy module, I have been relying on the correctness of the module to check the various things mentioned.

    In comparing the two strace excerpts, it appears to me that the error is occurring before the move process actually begins. In the strace segment that does work, I see that if the open attempt is successful, then the read/write sequences begin.

    I am still quite new to this level of script work. But if I am understanding the strace output correctly, this error is occurring before anything actually touches the file itself. It seems that something is opening the file and not getting it closed in time for the next open attempt. I just don't know what.

    May this involve delving into the File::Copy module and possible needing some kind of change or delay there? I have looked at the module, but the majority of it is way over my head.


    Thanks,
    Michael
      I have been relying on the correctness of the module to check the various things mentioned.

      Um, File::Copy::move()'s documentation says nothing about "Waits for the source file to be finished being created and then...".

      Trying to get the monitor/copier process to correctly determine whether the to-be-moved file is finished being written is likely a hard problem, perhaps an impossible problem (depending).

      That is why I outlined the "usual" way to have whatever is dumping these files into the source directory to do it in a way that makes it clear when the file being dumped there has been completely dumped (and is thus ready to be moved by the monitor/copier).

      - tye