[phpa] Patch for PHP 4.1.2 received

  • From: "Nick Lindridge" <nick@xxxxxxxxxxxxxxxxxxxxx>
  • To: <phpa@xxxxxxxxxxxxx>
  • Date: Fri, 19 Apr 2002 06:35:56 -0000 ()

Hi,

Thies kindly submitted a patch for the PHP 4.1.2 MySQL driver problem, and
that people may like to try.

In version 1.3 that I've been working on for a while (and formerly planned
as 1.2p5), I'm also now looking at adding detection for corrupted shared
memory in my ongoing quest for maximum resilience.

nick

>From thies@xxxxxxxxxxx  Fri Apr 19 00:59:05 2002
Return-Path: <thies@xxxxxxxxxxx>
Delivered-To: phpa@xxxxxxxxxxxxx
Received: from thiesos.org (a092104.adsl.hansenet.de [213.191.92.104])
        by turing.freelists.org (FreeLists Mail Multiplex) with ESMTP id
        399E2941CD for <phpa@xxxxxxxxxxxxx>; Fri, 19 Apr 2002 00:59:04 -0500
        (EST)
Received: by thiesos.org (Postfix, from userid 1000)
        id C5D6663E14; Fri, 19 Apr 2002 08:02:43 +0200 (CEST)
Date: Fri, 19 Apr 2002 08:02:43 +0200
From: "Thies C. Arntzen" <thies@xxxxxxxxxxx>
To: phpa@xxxxxxxxxxxxx
Subject: Re: [phpa] Re: Info on MySQL Driver/PHP 4.1.2 crash resolution
Message-ID: <20020419060243.GA8676@xxxxxxxxxxxxxxxxxxxx>
Reply-To: thies@xxxxxxxxxx
References: <200204120740.g3C7epM19009@xxxxxxxxxxxxxxxxxxxxxxxxx>
<000901c1e230$6ea047b0$093efea9@Portabase> Mime-Version: 1.0
Content-type: text/plain
Content-Disposition: inline
In-Reply-To: <000901c1e230$6ea047b0$093efea9@Portabase>
User-Agent: Mutt/1.3.28i
Content-Transfer-Encoding: 8bit

On Fri, Apr 12, 2002 at 09:43:35AM -0500, Matthew Mullenweg wrote:
>
> I use 4.01-alpha with PHP 4.1.2 and I still get the segmentation
> faults.

    yould you please apply the attached patch to Zend and report
    if it changes anything?

    cd php-4.1.2/Zend
    patch < /tmp/zend2.patch

    this patch could be 100% unrelated to the problem, but it
    might not;-)

    re,
    tc

-- Attached file included as plaintext by Ecartis --

Index: zend_hash.c
=================================================================== RCS
file: /repository/Zend/zend_hash.c,v
retrieving revision 1.83
diff -u -r1.83 zend_hash.c
--- zend_hash.c 6 Jan 2002 15:21:09 -0000       1.83
+++ zend_hash.c 18 Apr 2002 15:59:41 -0000
@@ -651,6 +651,23 @@
        SET_INCONSISTENT(HT_DESTROYED);
 }

+ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht)
+{
+       Bucket *p;
+
+       IS_CONSISTENT(ht);
+
+       p = ht->pListTail;
+       while (p != NULL) {
+               zend_hash_apply_deleter(ht, p);
+               p = ht->pListTail;
+       }
+
+       pefree(ht->arBuckets, ht->persistent);
+
+       SET_INCONSISTENT(HT_DESTROYED);
+}
+
 /* This is used to selectively delete certain entries from a hashtable.
  * destruct() receives the data and decides if the entry should be
  deleted  * or not
Index: zend_hash.h
=================================================================== RCS
file: /repository/Zend/zend_hash.h,v
retrieving revision 1.55
diff -u -r1.55 zend_hash.h
--- zend_hash.h 6 Jan 2002 15:21:09 -0000       1.55
+++ zend_hash.h 18 Apr 2002 15:59:41 -0000
@@ -119,6 +119,7 @@
 typedef int (*apply_func_args_t)(void *pDest, int num_args, va_list
 args, zend_hash_key *hash_key);

 ZEND_API void zend_hash_graceful_destroy(HashTable *ht);
+ZEND_API void zend_hash_graceful_reverse_destroy(HashTable *ht);
 ZEND_API void zend_hash_apply(HashTable *ht, apply_func_t apply_func
 TSRMLS_DC); ZEND_API void zend_hash_apply_with_argument(HashTable *ht,
 apply_func_arg_t apply_func, void * TSRMLS_DC); ZEND_API void
 zend_hash_apply_with_arguments(HashTable *ht, apply_func_args_t
 apply_func, int, ...);
Index: zend_list.c
=================================================================== RCS
file: /repository/Zend/zend_list.c,v
retrieving revision 1.52
diff -u -r1.52 zend_list.c
--- zend_list.c 6 Jan 2002 15:21:09 -0000       1.52
+++ zend_list.c 18 Apr 2002 15:59:41 -0000
@@ -230,32 +230,8 @@

 void zend_destroy_rsrc_list(HashTable *ht TSRMLS_DC)
 {
-       Bucket *p, *q;
-
-       while (1) {
-               p = ht->pListTail;
-               if (!p) {
-                       break;
-               }
-               q = p->pListLast;
-               if (q) {
-                       q->pListNext = NULL;
-               }
-               ht->pListTail = q;
-
-               if (ht->pDestructor) {
-                       zend_try {
-                               ht->pDestructor(p->pData);
-                       } zend_end_try();
-               }
-               if (!p->pDataPtr && p->pData) {
-                       pefree(p->pData, ht->persistent);
-               }
-               pefree(p, ht->persistent);
-       }
-       pefree(ht->arBuckets, ht->persistent);
+       zend_hash_graceful_reverse_destroy(ht);
 }
-

 static int clean_module_resource(zend_rsrc_list_entry *le, int
 *resource_id TSRMLS_DC) {


// eompost 3CBFB229:6328.1:cucn



------------------------------------------------------------------------
  www.php-accelerator.co.uk           Home of the free PHP Accelerator

To post, send email to phpa@xxxxxxxxxxxxx
To unsubscribe, email phpa-request@xxxxxxxxxxxxx with subject unsubscribe


Other related posts:

  • » [phpa] Patch for PHP 4.1.2 received