Description of problem: The error is appeared when I execute a script which very activly using simple_html_dom.php library. Version-Release number of selected component: php-cli-5.4.9-1.fc17 Additional info: backtrace_rating: 4 cmdline: /usr/bin/php ./catalog-parser.php crash_function: _zend_mm_free_int executable: /usr/bin/php kernel: 3.6.7-4.fc17.i686.PAE remote_result: NOTFOUND uid: 1000 xsession_errors: Truncated backtrace: Thread no. 1 (10 frames) #0 _zend_mm_free_int at /usr/src/debug/php-5.4.9/Zend/zend_alloc.c:2071 #1 _efree at /usr/src/debug/php-5.4.9/Zend/zend_alloc.c:2436 #2 zend_hash_destroy at /usr/src/debug/php-5.4.9/Zend/zend_hash.c:568 #3 _zval_dtor_func at /usr/src/debug/php-5.4.9/Zend/zend_variables.c:45 #4 _zval_dtor at /usr/src/debug/php-5.4.9/Zend/zend_variables.h:35 #5 zend_std_write_property at /usr/src/debug/php-5.4.9/Zend/zend_object_handlers.c:543 #6 zend_assign_to_object at /usr/src/debug/php-5.4.9/Zend/zend_execute.c:737 #7 ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_HANDLER at /usr/src/debug/php-5.4.9/Zend/zend_vm_execute.h:22269 #8 ZEND_USER_OPCODE_SPEC_HANDLER at /usr/src/debug/php-5.4.9/Zend/zend_vm_execute.h:1151 #9 execute at /usr/src/debug/php-5.4.9/Zend/zend_vm_execute.h:410
Created attachment 652987 [details] File: backtrace
Created attachment 652988 [details] File: build_ids
Created attachment 652989 [details] File: cgroup
Created attachment 652990 [details] File: core_backtrace
Created attachment 652991 [details] File: dso_list
Created attachment 652992 [details] File: environ
Created attachment 652993 [details] File: limits
Created attachment 652994 [details] File: maps
Created attachment 652995 [details] File: open_fds
Created attachment 652996 [details] File: proc_pid_status
Created attachment 652997 [details] File: var_log_messages
Created attachment 652998 [details] File: smolt_data
*** Bug 880516 has been marked as a duplicate of this bug. ***
*** Bug 880718 has been marked as a duplicate of this bug. ***
Thanks, for the various, tests. It seems it crash in the garbage collector. Could you try with -d zend.enable_gc=0 ? Are you able to provide a reproducer ? (as small as possible) ?
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 36 bytes) in /home/andrey/development/catalog-parser/simple_html_dom.php on line 1333 PHP Stack trace: PHP 1. {main}() /home/andrey/development/catalog-parser/catalog-parser.php:0 PHP 2. processCity() /home/andrey/development/catalog-parser/catalog-parser.php:62 PHP 3. processCategory() /home/andrey/development/catalog-parser/catalog-parser.php:18 PHP 4. parseCompany() /home/andrey/development/catalog-parser/catalog-parser.php:28 PHP 5. file_get_html() /home/andrey/development/catalog-parser/catalog-parser.php:37 PHP 6. simple_html_dom->load() /home/andrey/development/catalog-parser/simple_html_dom.php:84 PHP 7. simple_html_dom->parse() /home/andrey/development/catalog-parser/simple_html_dom.php:1068 PHP 8. simple_html_dom->read_tag() /home/andrey/development/catalog-parser/simple_html_dom.php:1174
Created attachment 653056 [details] the bug reproducer catalog-parser.php is the bug reproducer. simple_html_dom.php is the required library. Note: works slowly because uses slow sites. I have to wait several minutes before php crashes.
So, no more crash. > PHP Fatal error: Allowed memory size of 134217728 bytes exhausted... You just need to increase the limit.
I have increase the limit up to 512M but the result is the same except the php crashes earlie than it was with garbadge collector.
Without the Garbage Collector, there is a huge memory leak (because of massive use of circular references). $this->nodes[] = $this; running with -d zend.enable_gc=0 -d memory_limit=-1 will probably consume most of the memory (quickly use GB) The gc should clean this, but sometime raised a segfault or a "zend_mm_heap corrupted". Analysis is quite impossible without a minimal reproducer script... Can you please try to create one, and report this bug upstream (php) A workaround is to split this "huge" process in small ones (probably 1 per category).
Created attachment 653376 [details] catalog-parser.php Here is a (quick) possible implementation which seems to run without problem. Note: use pcntl_fork and include a simple "cache" to avoid multiple internet access during the tests.
Bug reported upstream with a "minimal" reproducer. https://bugs.php.net/63635 So, closing this one as UPSTREAM.