I have a small script that basically watches a folder. When a file is put into the folder, the script moves it to a different folder based on the file suffix. Randomly, the script will crash. I have run strace on the script and found what I believe is the crash point, but I don't know what to do about it.
Here is the relevant portion of the script:Here is an strace segment where the crash occurs:foreach $wavfile (@wavfile) { $newwavfile = $wavfile; $newwavfile =~ s/\/mnt\/xfer/\/mnt\/Audio\/dropbox\/wa +v/; move ($wavfile, $newwavfile) or die "Holy moly we got +us a wav error here hoss!"; }
19:51:13.072532 stat64("/mnt/Audio/dropbox/wav/31650_WRETCHED Radio 04 +-25_DIST.wav", 0x9a670c8) = -1 ENOENT (No such file or directory) 19:51:13.073455 stat64("/mnt/Audio/dropbox/wav/31650_WRETCHED Radio 04 +-25_DIST.wav", 0x9a670c8) = -1 ENOENT (No such file or directory) 19:51:13.073558 stat64("/mnt/xfer/31650_WRETCHED Radio 04-25_DIST.wav" +, {st_mode=S_IFREG|S_ISGID|S_ISVTX|0767, st_size=280369278, ...}) = 0 19:51:13.073722 rename("/mnt/xfer/31650_WRETCHED Radio 04-25_DIST.wav" +, "/mnt/Audio/dropbox/wav/31650_WRETCHED Radio 04-25_DIST.wav") = -1 +EXDEV (Invalid cross-device link) 19:51:13.073837 stat64("/mnt/xfer/31650_WRETCHED Radio 04-25_DIST.wav" +, {st_mode=S_IFREG|S_ISGID|S_ISVTX|0767, st_size=280369278, ...}) = 0 19:51:13.073960 stat64("/mnt/Audio/dropbox/wav/31650_WRETCHED Radio 04 +-25_DIST.wav", 0x9a670c8) = -1 ENOENT (No such file or directory) 19:51:13.074157 stat64("/mnt/xfer/31650_WRETCHED Radio 04-25_DIST.wav" +, {st_mode=S_IFREG|S_ISGID|S_ISVTX|0767, st_size=280369278, ...}) = 0 19:51:13.074293 stat64("/mnt/Audio/dropbox/wav/31650_WRETCHED Radio 04 +-25_DIST.wav", 0x9a670c8) = -1 ENOENT (No such file or directory) 19:51:13.074396 stat64("/mnt/Audio/dropbox/wav/31650_WRETCHED Radio 04 +-25_DIST.wav", 0x9a670c8) = -1 ENOENT (No such file or directory) 19:51:13.074532 open("/mnt/xfer/31650_WRETCHED Radio 04-25_DIST.wav", +O_RDONLY|O_LARGEFILE) = -1 ETXTBSY (Text file busy) 19:51:14.087239 unlink("/mnt/Audio/dropbox/wav/31650_WRETCHED Radio 04 +-25_DIST.wav") = -1 ENOENT (No such file or directory) 19:51:14.088126 write(2, "Holy moly we got us a wav error "..., 83) = +83 19:51:14.106966 exit_group(26) = ?
The attempt to open the file and the "-1 ETXTBSY (Text file busy)" error seems to be the crash point.
19:52:36.606041 stat64("/mnt/Audio/dropbox/wav/31650_WRETCHED Radio 04 +-25_DIST.wav", 0x94190c8) = -1 ENOENT (No such file or directory) 19:52:36.606938 stat64("/mnt/Audio/dropbox/wav/31650_WRETCHED Radio 04 +-25_DIST.wav", 0x94190c8) = -1 ENOENT (No such file or directory) 19:52:36.607039 stat64("/mnt/xfer/31650_WRETCHED Radio 04-25_DIST.wav" +, {st_mode=S_IFREG|S_ISGID|S_ISVTX|0767, st_size=280369278, ...}) = 0 19:52:36.607181 rename("/mnt/xfer/31650_WRETCHED Radio 04-25_DIST.wav" +, "/mnt/Audio/dropbox/wav/31650_WRETCHED Radio 04-25_DIST.wav") = -1 +EXDEV (Invalid cross-device link) 19:52:36.607336 stat64("/mnt/xfer/31650_WRETCHED Radio 04-25_DIST.wav" +, {st_mode=S_IFREG|S_ISGID|S_ISVTX|0767, st_size=280369278, ...}) = 0 19:52:36.607460 stat64("/mnt/Audio/dropbox/wav/31650_WRETCHED Radio 04 +-25_DIST.wav", 0x94190c8) = -1 ENOENT (No such file or directory) 19:52:36.607680 stat64("/mnt/xfer/31650_WRETCHED Radio 04-25_DIST.wav" +, {st_mode=S_IFREG|S_ISGID|S_ISVTX|0767, st_size=280369278, ...}) = 0 19:52:36.607818 stat64("/mnt/Audio/dropbox/wav/31650_WRETCHED Radio 04 +-25_DIST.wav", 0x94190c8) = -1 ENOENT (No such file or directory) 19:52:36.607920 stat64("/mnt/Audio/dropbox/wav/31650_WRETCHED Radio 04 +-25_DIST.wav", 0x94190c8) = -1 ENOENT (No such file or directory) 19:52:36.608058 open("/mnt/xfer/31650_WRETCHED Radio 04-25_DIST.wav", +O_RDONLY|O_LARGEFILE) = 3 19:52:36.608888 ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfdbb698) = +-1 ENOTTY (Inappropriate ioctl for device) 19:52:36.608963 _llseek(3, 0, [0], SEEK_CUR) = 0 19:52:36.609032 fstat64(3, {st_mode=S_IFREG|S_ISGID|S_ISVTX|0767, st_s +ize=280369278, ...}) = 0 19:52:36.609131 fcntl64(3, F_SETFD, FD_CLOEXEC) = 0 19:52:36.609225 open("/mnt/Audio/dropbox/wav/31650_WRETCHED Radio 04-2 +5_DIST.wav", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 4 19:52:36.609739 ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfdbb698) = +-1 ENOTTY (Inappropriate ioctl for device) 19:52:36.609837 _llseek(4, 0, [0], SEEK_CUR) = 0 19:52:36.609905 fstat64(4, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 19:52:36.610003 fcntl64(4, F_SETFD, FD_CLOEXEC) = 0 19:52:36.610077 fstat64(3, {st_mode=S_IFREG|S_ISGID|S_ISVTX|0767, st_s +ize=280369278, ...}) = 0 19:52:36.610200 mmap2(NULL, 2101248, PROT_READ|PROT_WRITE, MAP_PRIVATE +|MAP_ANONYMOUS, -1, 0) = 0xb7d07000 19:52:36.610284 read(3, "RIFFv\30\266\20WAVEfmt \20\0\0\0\1\0\1\0D\254 +\0\0\210X\1\0"..., 2097152) = 2097152 19:52:36.840512 write(4, "RIFFv\30\266\20WAVEfmt \20\0\0\0\1\0\1\0D\25 +4\0\0\210X\1\0"..., 2097152) = 2097152 19:52:36.842789 read(3, "\331\v\20\v\35\v\235\v\377\vW\f\311\fo\rT\16P +\17e\20\214\21U\22P\22\206\21j\20"..., 2097152)= 2097152 19:52:37.055588 write(4, "\331\v\20\v\35\v\235\v\377\vW\f\311\fo\rT\16 +P\17e\20\214\21U\22P\22\206\21j\20"..., 2097152) = 2097152
This time the attempt to open returns a '3' and the script proceeds to write the file to the new location.
The files vary from 5-50MB in size, but that does not seem to matter.
Any ideas on why this is happening and what I can do to fix it?
In reply to Random script crashes related to File::Copy by michael.barnes
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |