From: Antony Dovgal Date: Wed, 9 Aug 2006 10:16:20 +0000 (+0000) Subject: fix #8112 (Persistent connections misbehave when Apache process times out) X-Git-Tag: RELEASE_1_0_0RC1~2017 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=689f3a92b5ad7b3d11da52cf1b0cb09efff61cfa;p=php fix #8112 (Persistent connections misbehave when Apache process times out) --- diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 3993732f32..5dddc4b471 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -1760,6 +1760,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);