Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 730746 Details for
Bug 947444
PerlIO dead-locks with threaded fork
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
Test case
test (text/plain), 1.71 KB, created by
Petr Pisar
on 2013-04-02 12:52:22 UTC
(
hide
)
Description:
Test case
Filename:
MIME Type:
Creator:
Petr Pisar
Created:
2013-04-02 12:52:22 UTC
Size:
1.71 KB
patch
obsolete
>#!/usr/bin/perl > >use v5.8.9; >use threads; > >use strict; >use warnings; > >use File::Temp 'tempfile', 'unlink0'; > ># for debug, pass trival programs that can be spotted using 'watch pstree' >sub exec_debug { > my $pid = fork(); > exec(@_) if ($pid == 0); > return $pid; >} > > ># execute a test command and check the output >sub exec_and_check () { > > my ($tmph, $tmpname) = tempfile(); > > my $pid = fork(); > > if ($pid == 0) { > # in child > > # test fork/exec => no hangs > my $p0 = exec_debug('test'); > waitpid($p0, 0); > > # test dup => hangs sometimes > my $p1 = exec_debug('true'); > open(STDOUT, '>&', $tmph) || die "duplicating STDOUT to $tmpname failed: $!"; > waitpid($p1, 0); > > # test dup => no? > my $p2 = exec_debug('false'); > open(STDERR, '>&', \*STDOUT) || die "duplicating STDOUT to STDERR failed: $!"; > waitpid($p2, 0); > > ### excecute (here a dummy cmd) > exec('sleep', 0); > } > > # in parent > > waitpid($pid, 0); > > ### check output > open(my $fh, $tmpname); > while (my $line = <$fh>) { > ; # check (here empty) > } > unlink0($fh, $tmpname) > or die "Error unlinking file $tmpname safely"; > >} > ># run a test in a number of variants >sub runtest_vary ($) { > for (my $i = 0; $i < 100; ++$i) { > exec_and_check(); > } >} > ># wait for thread completion >sub threads_wait () { > for (; threads->list() > 0;) { > for (;;sleep(1)) { > my @thrs = threads->list(threads::joinable); > if (@thrs > 0) { > $thrs[0]->join(); > last; > } > } > } >} > ># run all tests >for (my $i = 0; $i < 100; ++$i) { > threads->create(\&runtest_vary); >} >threads_wait();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 947444
: 730746