Re: Re: PHP4.0.7RC1 memory problem

From: Date: Wed, 05 Sep 2001 07:03:06 +0000
Subject: Re: Re: PHP4.0.7RC1 memory problem
References: 1 2 3  Groups: php.dev php.qa 
Request: Send a blank email to php-dev+get-65132@lists.php.net to get a copy of this message
Zeev Suraski wrote:

Do you use dl() anywhere? Is the crash reproducible?
Hi Zeev, I'm glad you are interested in. I don't use dl(). This crash is reproducible, but I could not make it reproduce with simpler script, yet. Anyway, there is other code that crashes PHP which I can report details. I have Form classes handle HTML form. In the classes, there is a following method // Form_Email class function _validate($val) { error_log("called _validate()\n",3,'/tmp/php_elog'); if (!$this->required && !$val) { return ''; } if (!eregi($this->valid_regex, $val, $regs)) { return "ERROR"; //$this->valid_e; } error_log("regex check done\n",3,'/tmp/php_elog'); $host = $regs[1]; $err = ''; switch ($this->check_lev) { case "hard": case "normal": if (!checkdnsrr($host,'MX')) { $err = "No MX entry in DNS"; } break; } error_log("return _validate()\n",3,'/tmp/php_elog'); return $err; } There is other class called From which has "HAS A" relationship to Form_Email class. From object has colletion of form element objects as array. In the Form class, appropriate elements are selected and _validate method is called as variable function(method). (i.e. $object->$method()) Once this method is called, PHP calls this method over and over until PHP reaches memory limit. I don't get SIGSEGV for this one. Interesting behavior is, this problem cannot be reproduced with much simpler Form class test script. It happens when I use these Form classes within an Application class. (Form object is defined as global) However, if I comment out checkdnsrr() call, it works as expetecd. NOTE: I experienced similar behavior when I encountered foreach() bug. PHP stopped looping when I comment out or move some statements, even if real problem was in foreach() code. I'll try to find the cause this afternoon. However, I think I won't find what's wrong... I needed to spend MANY hours to find out foreach() had a bug... Please let me know, if you have anything you need or you want me to do. Any suggestions are welcome. Thanks Jani, I tied without dmalloc. It seems dmalloc does not relate to this problem. -- Yasuo Ohgaki
At 10:05 04-09-01, Yasuo Ohgaki wrote:
FYI PHP 4.0.8-dev (updated about 30 min ago) has the same problem. BTW, I don't enable output compression in PHP. No custom output handler. I enabled mbstr-enc-trans, but there should be no acutual translation, since I'm using EUC-JP for both internal/output encoding. Yasuo Ohgaki Yasuo Ohgaki wrote:
I got SIGSEGV. GNU gdb 5.0rh-5 Red Hat Linux 7.1 Copyright 2001 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux"... (gdb) run -X Starting program: /usr/sbin/httpd -X [Tue Sep 4 14:10:25 2001] [warn] Loaded DSO lib/apache/mod_gzip.so uses plain Apache 1.3 API, this module might crash under EAPI! (please recompile it with -DEAPI) Program received signal SIGSEGV, Segmentation fault. 0x40106fb6 in chunk_free (ar_ptr=0x401aff00, p=0x819f1f8) at malloc.c:3142 3142 malloc.c: No such file or directory.
    in malloc.c
(gdb) bt #0 0x40106fb6 in chunk_free (ar_ptr=0x401aff00, p=0x819f1f8) at malloc.c:3142 #1 0x40106d59 in __libc_free (mem=0x819f200) at malloc.c:3054 #2 0x40597a05 in free_zend_constant (c=0x81bc1a8) at zend_constants.c:34 #3 0x405b2a59 in zend_hash_del_key_or_index (ht=0x80bfca8, arKey=0x81bc190 "include_path",
    nKeyLength=13, h=3932814155, flag=0) at zend_hash.c:512
#4 0x405b3340 in zend_hash_reverse_apply (ht=0x80bfca8,
    apply_func=0x40597acc <clean_non_persistent_constant>) at zend_hash.c:741
#5  0x40597e86 in clean_non_persistent_constants () at zend_constants.c:163
#6 0x405a1da8 in shutdown_executor () at zend_execute_API.c:194 #7 0x405ac92f in zend_deactivate () at zend.c:594 #8 0x405bde23 in php_request_shutdown (dummy=0x0) at main.c:736 #9 0x405ba12e in apache_php_module_main (r=0x81993f8, display_source_mode=0)
    at sapi_apache.c:96
#10 0x405baf24 in send_php (r=0x81993f8, display_source_mode=0,
    filename=0x819b160 "/home/httpd/dev/ygb/support/feedback/question/index.shtml")
    at mod_php4.c:575
#11 0x405baf9e in send_parsed_php (r=0x81993f8) at mod_php4.c:590 #12 0x08055927 in ap_invoke_handler () at eval.c:41 #13 0x08069bdb in process_request_internal () at eval.c:41 #14 0x08069c3c in ap_process_request () at eval.c:41 #15 0x08061011 in child_main () at eval.c:41 #16 0x080611e0 in make_child () at eval.c:41 #17 0x08061354 in startup_children () at eval.c:41 #18 0x080619a3 in standalone_main () at eval.c:41 #19 0x080621db in main () at eval.c:41 #20 0x400a3177 in __libc_start_main (main=0x8061e28 <main>, argc=2, ubp_av=0xbffffa3c,
    init=0x804fa20 <_init>, fini=0x8099f6c <_fini>, rtld_fini=0x4000e184 <_dl_fini>,
    stack_end=0xbffffa34) at ../sysdeps/generic/libc-start.c:129
(gdb) ./configure \ --enable-debug \ --with-dmalloc \ --with-apxs \ --disable-short-tags \ --without-mysql \ --enable-bcmath \ --enable-ftp \ --enable-shmop \ --enable-sysvsem \ --enable-sysvshm \ --enable-sockets \ --enable-mbstring \ --enable-mbstr-enc-trans \ --enable-memory-limit \ --enable-wddx \ --with-bz2 \ --with-curl \ --with-ftp \ --with-iconv \ --with-mhash \ --with-mcrypt \ --with-openssl \ --with-pgsql \ --with-regex=system \ --with-zlib \ --with-gd=../gd-2.0.1 \ --enable-gd-native-ttf \ --with-freetype-dir=/usr/local \ --with-jpeg-dir=/usr \ --with-png-dir=/usr \ --with-xpm-dir=/usr/X11R6 \
_________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
-- Zeev Suraski <zeev@zend.com> CTO & co-founder, Zend Technologies Ltd. http://www.zend.com/
_________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com

Thread (13 messages)

« previous php.dev (#65132) next »