I'm hesitant to merge a fix for an unreproducible problem to a stable release.
PHP 5.2 connection code is very different to PHP 5.3

The num_links change could be merged, but this is only used in phpinfo(), so
it has low impact/usefulness.

Chris

Antony Dovgal wrote:

MFH to 5_2 ?

On 28.08.2008 10:33, Christopher Jones wrote:
sixd        Thu Aug 28 06:33:24 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/oci8    oci8.c   Log:
  MFH: Bug #45888 (Refcounting in ZTS mode)
http://cvs.php.net/viewvc.cgi/php-src/ext/oci8/oci8.c?r1=1.269.2.16.2.38.2.22&r2=1.269.2.16.2.38.2.23&diff_format=u
Index: php-src/ext/oci8/oci8.c
diff -u php-src/ext/oci8/oci8.c:1.269.2.16.2.38.2.22 php-src/ext/oci8/oci8.c:1.269.2.16.2.38.2.23 --- php-src/ext/oci8/oci8.c:1.269.2.16.2.38.2.22 Wed Aug 6 07:54:40 2008
+++ php-src/ext/oci8/oci8.c    Thu Aug 28 06:33:24 2008
@@ -26,7 +26,7 @@
+----------------------------------------------------------------------+
 */
-/* $Id: oci8.c,v 1.269.2.16.2.38.2.22 2008/08/06 07:54:40 tony2001 Exp $ */
+/* $Id: oci8.c,v 1.269.2.16.2.38.2.23 2008/08/28 06:33:24 sixd Exp $ */
#ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1285,7 +1285,7 @@
 #ifdef ZTS
zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_descriptor TSRMLS_CC); zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_collection TSRMLS_CC);
-    while (OCI_G(num_statements)) {
+    while (OCI_G(num_statements) > 0) {
zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_statement TSRMLS_CC);
     }
 #endif
@@ -1297,7 +1297,9 @@
zend_hash_apply(&EG(persistent_list), (apply_func_t) php_oci_persistent_helper TSRMLS_CC); #ifdef ZTS - zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_connection TSRMLS_CC);
+    while (OCI_G(num_links) > OCI_G(num_persistent)) {
+ zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) php_oci_list_helper, (void *)le_connection TSRMLS_CC);
+    }
     php_oci_cleanup_global_handles(TSRMLS_C);
 #endif
@@ -1311,7 +1313,7 @@
     php_info_print_table_start();
     php_info_print_table_row(2, "OCI8 Support", "enabled");
     php_info_print_table_row(2, "Version", PHP_OCI8_VERSION);
- php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.38.2.22 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.269.2.16.2.38.2.23 $"); snprintf(buf, sizeof(buf), "%ld", OCI_G(num_persistent));
     php_info_print_table_row(2, "Active Persistent Connections", buf);
@@ -1369,6 +1371,7 @@
     if (connection) {
         php_oci_connection_close(connection TSRMLS_CC);
         OCI_G(num_persistent)--;
+        OCI_G(num_links)--;
     }
 } /* }}} */
@@ -1979,11 +1982,11 @@
     if (persistent) {
         zend_bool alloc_non_persistent = 0;
- if (OCI_G(max_persistent)!=-1 && OCI_G(num_persistent)>=OCI_G(max_persistent)) { + if (OCI_G(max_persistent) != -1 && OCI_G(num_persistent) >= OCI_G(max_persistent)) {
             /* try to find an idle connection and kill it */
zend_hash_apply(&EG(persistent_list), (apply_func_t) php_oci_persistent_helper TSRMLS_CC); - if (OCI_G(max_persistent)!=-1 && OCI_G(num_persistent)>=OCI_G(max_persistent)) { + if (OCI_G(max_persistent) != -1 && OCI_G(num_persistent) >= OCI_G(max_persistent)) { /* all persistent connactions are in use, fallback to non-persistent connection creation */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Too many open persistent connections (%ld)", OCI_G(num_persistent));
                 alloc_non_persistent = 1;
@@ -2070,6 +2073,7 @@
         }
zend_hash_update(&EG(persistent_list), connection->hash_key, strlen(connection->hash_key)+1, (void *)&new_le, sizeof(zend_rsrc_list_entry), NULL);
         OCI_G(num_persistent)++;
+        OCI_G(num_links)++;
     } else if (!exclusive) {
connection->rsrc_id = zend_list_insert(connection, le_connection);
         new_le.ptr = (void *)connection->rsrc_id;






--
Email: [EMAIL PROTECTED]  Tel: +1 650 506 8630
Twitter:  http://twitter.com/ghrd    Free PHP Book: http://tinyurl.com/f8jad

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to