|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-07-15 23:27 UTC] spiros_ioannou at yahoo dot gr
Description: ------------ When using pcntl_fork to fork children, and *only* the parent uses the Postgres PDO database connection, the connection becomes unusable after the first child exits and the signal handler is called. If SIGCHLD signal handler is omitted PDO works normally for parent. Tested with and without persistent connections. Possible relevant bugs: 48447, 45797 Actual result: -------------- PHP Warning: PDOStatement::execute(): SQLSTATE[HY000]: General error: 7 server closed the connection unexpectedly This probably means the server terminated abnormally PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 05:00:01 2025 UTC |
I confirm the existence of this error in php 7. Here is example code: test1.php: <?php defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(__DIR__ . '/application')); defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development')); require_once 'Zend/Application.php'; $application = new Zend_Application( APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini' ); $db = new Zend_Db_Adapter_Pdo_Pgsql(array( 'host' => 'localhost', 'username' => 'test', 'password' => 'hasłodlatest', 'dbname' => 'test' )); echo 'start' . "\n"; $select = $db->select()->from('aaa', '*'); print_r($db->fetchOne($select)); echo "\n"; $pid = pcntl_fork(); if ($pid == -1) { // pcntl_fork() failed echo('could not fork'); } elseif ($pid) { } elseif ($pid == 0) { // you're in the new (child) process exec('/usr/bin/php /home/idea/CLI/test2.php &>/home/idea/CLI/test.log &'); exit; } echo 'After fork' . "\n"; while (true) { sleep(5); $select = $db->select()->from('aaa', '*'); print_r($db->fetchOne($select)); } test2.php: <?php echo 'Forked' . "\n";