Subject: | Possible file locking issue in test suite |
On FreeBSD systems the t/01_output.t test hangs:
...
# Subtest: missing adapter_name
ok 1 - instantiation dies
1..1
ok 1 - missing adapter_name
# Subtest: without adapter_params
ok 1 - 'instantiation ok' isa 'Message::Passing::Output::Log::Any::Adapter'
ok 2 - consume ok
ok 3 - message appeared in memory
1..3
ok 2 - without adapter_params
# Subtest: with adapter_params
ok 1 - 'instantiation ok' isa 'Message::Passing::Output::Log::Any::Adapter'
(here it hangs)
SIGINFO says:
load: 0.81 cmd: perl 52502 [lockf] 242.16r 0.00u 0.09s 0% 16660k
So it hangs while trying to get a lock. Running the test with truss shows these probably relevant lines:
52172: 0.360645278 0.000270426 openat(AT_FDCWD,"/tmp/rlMZTM7L47",O_RDWR|O_EXLOCK|O_NOFOLLOW|O_CREAT|O_EXCL,0600) = 3 (0x3)
...
52172: 0.369712352 0.000025702 openat(AT_FDCWD,"/tmp/rlMZTM7L47",O_WRONLY|O_APPEND|O_CREAT,0666) = 4 (0x4)
...
52172: 13.790323631 13.400977220 flock(0x4,0x2) = 131 (0x83)
So the temporary file was already opened with a lock (O_EXLOCK) (this is standard behavior of File::Temp on *BSD systems) and the flock syscall later hangs. Probably this could be fixed by not locking the temporary file in the beginning, i.e. using something like this:
($fh, $filename) = tempfile($template, EXLOCK => 0);
Note that http://matrix.cpantesters.org/?dist=Message-Passing-Output-Log-Any-Adapter+0.003 shows no results for netbsd and openbsd, so these operating systems are also affected. The fails on freebsd probably happen because a watcher script killed the hanging test.