t/op/threads.t: unit test 10 frequently fails on threaded builds on NetBSD
Nobody has claimed this yet.
- Dominant language
- Perl
- Stars
- 2.3k
- Forks
- 646
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 49
Description
During smoke-testing, t/op/threads.t often (but not always) fails in threaded builds on NetBSD and other OSes. See, for example, these smoke-test reports:
http://perl5.test-smoke.org/report/99678
http://perl5.test-smoke.org/report/108475
The smoke-test reports, which are from NetBSD VMs set up by Carlos and myself, typically only say:
Test failures:
~~ ../t/op/threads.t ...... FAILED Bad plan. You planned 30 tests but ran 9.
[stdio] -Duseithreads
'FAILED Bad plan' usually indicates that the program has crashed. The 'ran 9' suggests that the crash occurred during unit test 10. Here is t/op/threads.t test 10:
# [perl #45053] Memory corruption with heavy module loading in threads
#
# run-time usage of newCONSTSUB (as done by the IO boot code) wasn't
# thread-safe - got occasional coredumps or malloc corruption
watchdog(180, "process");
{
local $SIG{__WARN__} = sub {}; # Ignore any thread creation failure warnings
my @t;
for (1..10) {
my $thr = threads->create( sub { require IO });
last if !defined($thr); # Probably ran out of memory
push(@t, $thr);
}
$_->join for @t;
ok(1, '[perl #45053]');
}
... where watchdog is a function defined in t/test.pl for the purpose of "timeout the entire test file".
This test was added in October 2007 in response to RT 45053, which is now https://github.com/Perl/perl5/issues/9008, "Memory corruption with heavy module loading in threads."
Typically, when I run this test file on a threaded build on NetBSD outside the context of smoke-testing, it PASSes.
Is there any way this test could be made less fragile? @jdhedden
Thank you very much.
Jim Keenan
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with test 10 in t/op/threads.t and the watchdog implementation in t/test.pl. Reproduce the failure on a threaded NetBSD build and compare the linked smoke-test reports with standalone runs. Done means the threaded test no longer intermittently aborts with a bad plan while preserving its coverage and expected test count.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- perl
- Domain
- operating-systems, testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100