Skip to content

Commit 036ad2f

Browse files
ancientwizarddjzort
authored andcommitted
Added proof that connecting to the DB in the parent results in at
least one additional non-Perl thread is created. If this thread is tapped to handle the SIGCHLD SEGV will result.
1 parent b8c99bb commit 036ad2f

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

t/92-segv-fork.t

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,31 @@ PERL_NOTICE:
4747
note qx|perl -V| if $VERBOSE;
4848
}
4949

50+
sub bark_thread_count
51+
{
52+
my $expected = shift || 2;
53+
my $proc = sprintf '/proc/%s/status', $$;
54+
if ( -f $proc && open my $_PROC, '<', $proc )
55+
{
56+
is $_, $expected, 'Expected thread count=' . $expected for map { ( split ' ' )[1] } grep { m=Threads= } <$_PROC>;
57+
$_PROC && ( $_PROC->close or warn $! )
58+
}
59+
return;
60+
}
61+
5062
ORACLE_READY:
5163
{
52-
Child::Queue->do_connect( { PrintError => 0 } ) or plan skip_all => "Unable to connect to oracle\n";
64+
section 'ORACLE - READY';
65+
bark_thread_count(1);
66+
my $dbh = Child::Queue->do_connect( { PrintError => 0 } ) or plan skip_all => "Unable to connect to oracle\n";
67+
if ( $dbh )
68+
{
69+
is $dbh->do(qq|ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD"T"HH24:MI:SS"Z"'|), '0E0', 'ALTER SESSION SET NLS_DATE_FORMAT';
70+
is $dbh->do(qq|ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD"T"HH24:MI:SS"Z"'|), '0E0', 'ALTER SESSION SET NLS_TIMESTAMP_FORMAT';
71+
is $dbh->do(qq|ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT = 'YYYY-MM-DD"T"HH24:MI:SS"Z"'|), '0E0', 'ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT';
72+
warn Dumper( $dbh->selectall_arrayref(qq|SELECT SYSTIMESTAMP AT TIME ZONE 'UTC' FROM DUAL|));
73+
}
74+
bark_thread_count(2);
5375
}
5476

5577
QUEUE_BASICS:

0 commit comments

Comments
 (0)