]> granicus.if.org Git - php/commitdiff
fix #8112 (Persistent connections misbehave when Apache process times out)
authorAntony Dovgal <tony2001@php.net>
Wed, 9 Aug 2006 10:16:20 +0000 (10:16 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 9 Aug 2006 10:16:20 +0000 (10:16 +0000)
ext/oci8/oci8.c

index 3993732f323884acd883041d9cc3a42e6de3fbb0..5dddc4b471531fa6c23c7f4deb83ca0c415fa09a 100644 (file)
@@ -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);