什么情况会导致这种情况?
opendir(my $dh, $tdir) or die "Could not open temp dir: $!";
for my $file (readdir($dh)) {
print STDERR "checking file $tdir/$file\n";
next unless -e "$tdir/$file";
print STDERR "here's the file for $tdir/$file: ";
print STDERR `cat $tdir/$file`;
die "Not all files from hub '$hid' have been collected!: $tdir/$file";
}输出:
checking file
/tmp/test2~22363~0G0Tjv/22363~0~4~22380~0~1~Test2~Event~Note
here's the file for /tmp/test2~22363~0G0Tjv/22363~0~4~22380~0~1~Test2~Event~Note:
cat: /tmp/test2~22363~0G0Tjv/22363~0~4~22380~0~1~Test2~Event~Note: No such file or directory
IPC Fatal Error: Not all files from hub '22363~0~4' have been collected!:理论上,我认识到其他进程或线程可能在循环之间踩在我的文件上,但这是Perl (单线程)和test 2/test::Simple的测试目录,它应该仅限于由主进程管理。
我来到这里的原因是,我在其他代码中看到了类似的错误:
if(-e $cachepath) {
unlink $cachepath
or Carp::carp("cannot unlink...它会抛出“无法断开链接”
也是
$cache_mtime = (stat($cachepath))[_ST_MTIME];
....
if ($cache_mtime){
open my($in), '<:raw', $cachepath
or $self->_error("LoadError: Cannot open $cachepath for reading:它会抛出"LoadError:无法打开.“异常
在这些情况下,也应该只有一个进程在目录上运行,这让我怀疑发生了什么事情。
这是linux内核,完全是供应商补丁程序的最新版本.
发布于 2017-04-18 00:15:29
事实证明,它确实是子进程和种族条件。Test::Simple中较新的代码在嵌套子测试中不能很好地工作。无论如何,谢谢您允许我排除一些我不知道的文件系统问题。
https://stackoverflow.com/questions/43458387
复制相似问题