ID:               33994
 User updated by:  greatwhitepine at bigfoot dot com
 Reported By:      greatwhitepine at bigfoot dot com
 Status:           Open
 Bug Type:         Scripting Engine problem
 Operating System: Tru64 UNIX V5.1B (Rev. 2650)
 PHP Version:      5.0.4
 New Comment:

Sorry, forgot the pcntl_waitpid during my 1st edit (see below).

ingres_connect($str_database, $str_username, $str_password);
if (ingres_query('select count(*) from auto_ldg_run')) {
  print 'db ok during fork'."\n\n";
}
$int_pid = pcntl_fork();
if(!$int_pid) {
  ingres_connect($str_database, $str_username, $str_password);
  if (ingres_query('select count(*) from auto_ldg_run')) {
    print 'db ok for child'."\n\n";
  }
  exit();
} 
pcntl_waitpid ($int_pid, $str_status);
ingres_connect($str_database, $str_username, $str_password);
if (!ingres_query('select count(*) from auto_ldg_run')) {
  print 'db not ok after fork'."\n\n";
}
exit(1);


Previous Comments:
------------------------------------------------------------------------

[2005-08-04 08:03:06] greatwhitepine at bigfoot dot com

Description:
------------
As per the manual ingres_connect connections are terminated when the
process exits.  When a forked child exits the connection is terminated
permanently until the parent process is restarted.

Reproduce code:
---------------
ingres_connect($str_database, $str_username, $str_password);
if (ingres_query('select count(*) from table')) {
  print 'db ok during fork'."\n\n";
}
$int_pid = pcntl_fork();
if(!$int_pid) {
  ingres_connect($str_database, $str_username, $str_password);
  if (ingres_query('select count(*) from table')) {
    print 'db ok for child'."\n\n";
  }
  exit();
} 
ingres_connect($str_database, $str_username, $str_password);
if (!ingres_query('select count(*) from table')) {
  print 'db not ok after fork'."\n\n";
}


Expected result:
----------------
db ok during fork

db ok for child

Actual result:
--------------
db ok during fork

db ok for child


Warning: ingres_query(): Ingres II:  Server or API error : Read from
peer process failed; it may have exited. in
/home/its/autoldg/lib/php/local/lib_autoldg_daemon.php on line 228

Warning: ingres_query(): Ingres II:  SQLSTATE : 08004 in
/home/its/autoldg/lib/php/local/lib_autoldg_daemon.php on line 228
db not ok after fork


Warning: Unknown: Ingres II:  Server or API error : API function cannot
be called in the current state. in Unknown on line 0

Warning: Unknown: Ingres II:  SQLSTATE : 5000R in Unknown on line 0

Warning: Unknown: Ingres II:  Unable to close statement !! in Unknown
on line 0

Warning: Unknown: Ingres II:  Unable to rollback transaction !! in
Unknown on line 0


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=33994&edit=1

Reply via email to