RE: DBD::Oracle install failed for fork test in t/10general.t



Yes, I underserstand.
Removing $ORACLE_SID from "dbi:Oracle:" forces the driver to look for
the service name in
environment variables $ORACLE_SID and $TWO_TASK. If envirmonment
variable $ORACLE_SID is set,
the connection is local and a dedicated server is bequeathed (spawned)
directly.
Next a signal handler is set up to catch all SIGCHLD's, but
unfortuncately, catches
the child spawned by Perl's 'system' function.

The Net Services Admin Guide lists a sqlnet.ora flag to turn the signal
handler off.
BEQUEATH_DETACH = yes

The documentation says this leaves the job of catching the dedicated
server
to th 'Unix init process'. I'm not sure what 'Unix init process' is,
but when I set the flag,
the Perl 'system' function catches the process it spawned and
the 'Unix init process' catches the 'dedicated server'.
No zombies left at the end.

My tsnames.ora and sqlnet.ora are in /mydir.
/mydir/sqlnet.ora contains 'BEQUEATH_DETACH = yes'.

export TNS_ADMIN=/mydir
perl -Mblib t/10general.t

This appears to work

thank you so much for your help.

Albert Tom
2600 Camino Ramon
San Ramon, Ca. 94583
925-823-9881



-----Original Message-----
From: Charles Jardine [mailto:cj10@xxxxxxxxx]
Sent: Tuesday, June 17, 2008 9:23 AM
To: TOM, ALBERT K (ATTSI)
Cc: dbi-users@xxxxxxxx
Subject: Re: DBD::Oracle install failed for fork test in t/10general.t


On 16/06/08 20:23, TOM, ALBERT K (ATTSI) wrote:
Hi,

I'm installing DBD::Oracle 1.20 and I'm getting the following error
from 't/10general.t'.

not ok 1 - system exit 1 should return 256
# Failed test (t/10general.t at line 45)
# got: '-1'
# expected: '256'
not ok 2 - system exit 0 should return 0
# Failed test (t/10general.t at line 46)
# got: '-1'
# expected: '0'

I have seen this exact symptom reported before. I believe it happens
with Oracle 10 (but not with Oracle 9), the the 'bequeather' connection
methoid is usedd - fore example, by setting the environment variable
ORACLE_SID to the system identifier of a local database instance.

I think something harvest the child that 'system' spawned before
'system' could reap it.

I think, thought I am not sure, that, in the 'bequeather' case,
Oracle sets a SIGCHLD handler in the perl scripts process.
This would break the test above, and also break perl's 'system'
built in, backticks, and all forms of '|' opens.

Avoid the bequeather.

This is also puzzling.
It works when I ran a script pointing to the 'blib'.
Here is the script:

#!/usr/local/perl/bin/perl -w
use lib '/tmp/at2191/tmp_perl/lib/perl5/site_perl'; # tmp lib
containing DBI 1.604
use blib '/tmp/at2191/install/dbd_orc/DBD-Oracle-1.20/blib'; # use
blib
containing DBD 1.20
use DBI qw(:sql_types :utils);
print "$_\n" for @INC;

$ORACLE_SID = 'uclde';
$ORACLE_HOME = '/usr/local/opt/oracle/product/10.2.0';
$ENV{'ORACLE_HOME'} = $ORACLE_HOME;

$dbh = DBI->connect( "dbi:Oracle:$ORACLE_SID",

This form of connect will not use the 'bequeather'. You
have not set the ORACLE_SID environment variable.

'ndpprod',
'prod',
{ RaiseError => 0,
PrintError => 1,
AutoCommit => 0
}
) ||
die "Database connection not made: $DBI::errstr";
print "Database Name is $dbh->{Name}\n";

for (1, 0) {
$rc = system("exit $_;");
print "\$rc [$rc]\n";
print "\$! [$!]\n";
}

END {
$dbh->disconnect if $dbh;
print "end of script\n";
}

The output from the script is:

/tmp/at2191/install/dbd_orc/DBD-Oracle-1.20/blib/arch
/tmp/at2191/install/dbd_orc/DBD-Oracle-1.20/blib/lib
/tmp/at2191/tmp_perl/lib/perl5/site_perl
/appl_dsl/mod_perl/lib/perl5/site_perl
/usr/local/cm58/lib/perl5/5.8.7/sun4-solaris-64
/usr/local/cm58/lib/perl5/5.8.7
/usr/local/cm58/lib/perl5/site_perl/5.8.7/sun4-solaris-64
/usr/local/cm58/lib/perl5/site_perl/5.8.7
/usr/local/cm58/lib/perl5/site_perl
.
Database Name is uclde
$rc [256]
$! []
$rc [0]
$! []
end of script

I was wondering if anyone knows the cause of why the test in
't/10general.t' failed.

Albert Tom
2600 Camino Ramon
San Ramon, Ca. 94583
925-823-9881




--
Charles Jardine - Computing Service, University of Cambridge
cj10@xxxxxxxxx Tel: +44 1223 334506, Fax: +44 1223 334679
.



Relevant Pages

  • Re: Cant call method "prepare" on an undefined value
    ... There are at least THREE ways to compromise the database, the webserver and to send arbitary mails. ... If you need assistance in making the script work securely, using taint mode, CGI and DBI methods, contact me via e-mail. ... You modify the environment at RUN TIME, when the Oracle client libraries have already been initialised without the missing environment variables. ... I have one oracle database located at server A and setup the Oracle ...
    (perl.dbi.users)
  • Re: Trouble programming the mysterious blank key
    ... >> The problem with putting it in an RC script is it has to talk to the X ... The reason for this is that X clients know how to talk to the server ... by looking for an environment variable called DISPLAY. ... of course environment variables are specific to a given process, ...
    (comp.unix.solaris)
  • RE: ORA-01017 ... but only when script is run as CGI
    ... server at all? ... environment variables. ... Comparison of the output in command-line and CGI ... Removing that line fixed the problem, and the script ...
    (perl.dbi.users)
  • Re: DBD-SQLAnywhere-1.16
    ... Before you can bring up the server version using "dbsrv10" You have to install the environment variables ... Then bring up the server with "dbsrv10 -n demo10 /opt/sqlanywhere10/demo.db -ud". ... I don't have DBD::SQLAnywhere installed at all - I only thought a) there may be some failures in the test results that you'd find useful and b) you didn't actually tell us what did not work. ...
    (perl.dbi.users)
  • Re: logon/logoff scripts...
    ... I am using the %clientname% and %machine% name environment variables to ... each user you can specify a login script but nowhere do I see the ...
    (microsoft.public.backoffice.smallbiz2000)