From: Antony Dovgal Date: Wed, 9 Aug 2006 10:16:50 +0000 (+0000) Subject: MFH: fix #8112 (Persistent connections misbehave when Apache process times out) X-Git-Tag: php-5.2.0RC2~64 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4c5691bd025f091f1b327bf0a5bf589f62494091;p=php MFH: fix #8112 (Persistent connections misbehave when Apache process times out) --- diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 9b64d65afc..25465637b4 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -1745,6 +1745,17 @@ static int php_oci_persistent_helper(zend_rsrc_list_entry *le TSRMLS_DC) connection = (php_oci_connection *)le->ptr; if (connection->used_this_request) { + if ((PG(connection_status) & PHP_CONNECTION_TIMEOUT)) { + /* call OCIBreak() on timeout to avoid appearance of deadlocked persistent connections */ + connection->errcode = PHP_OCI_CALL(OCIBreak, (connection->svc, connection->err)); + if (connection->errcode != OCI_SUCCESS) { + php_oci_error(connection->err, connection->errcode TSRMLS_CC); + PHP_OCI_HANDLE_ERROR(connection, connection->errcode); + /* OCIBreak() failed. delete the connection */ + return 1; + } + } + if (connection->descriptors) { zend_hash_destroy(connection->descriptors); efree(connection->descriptors);