Bug 880752 - [abrt] php-cli-5.4.9-1.fc17: _zend_mm_free_int: Process /usr/bin/php was killed by signal 11 (SIGSEGV)
Summary: [abrt] php-cli-5.4.9-1.fc17: _zend_mm_free_int: Process /usr/bin/php was kill...
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: php
Version: 17
Hardware: i686
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Joe Orton
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:28ff68b7eb4f2d63c3e62f25478...
: 880516 880718 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-11-27 18:12 UTC by Andrey V. Henneberg
Modified: 2012-11-28 11:21 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2012-11-28 11:21:15 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
File: backtrace (28.68 KB, text/plain)
2012-11-27 18:12 UTC, Andrey V. Henneberg
no flags Details
File: build_ids (3.36 KB, text/plain)
2012-11-27 18:12 UTC, Andrey V. Henneberg
no flags Details
File: cgroup (129 bytes, text/plain)
2012-11-27 18:12 UTC, Andrey V. Henneberg
no flags Details
File: core_backtrace (3.91 KB, text/plain)
2012-11-27 18:12 UTC, Andrey V. Henneberg
no flags Details
File: dso_list (6.99 KB, text/plain)
2012-11-27 18:12 UTC, Andrey V. Henneberg
no flags Details
File: environ (3.19 KB, text/plain)
2012-11-27 18:12 UTC, Andrey V. Henneberg
no flags Details
File: limits (1.29 KB, text/plain)
2012-11-27 18:13 UTC, Andrey V. Henneberg
no flags Details
File: maps (20.45 KB, text/plain)
2012-11-27 18:13 UTC, Andrey V. Henneberg
no flags Details
File: open_fds (345 bytes, text/plain)
2012-11-27 18:13 UTC, Andrey V. Henneberg
no flags Details
File: proc_pid_status (793 bytes, text/plain)
2012-11-27 18:13 UTC, Andrey V. Henneberg
no flags Details
File: var_log_messages (4.53 KB, text/plain)
2012-11-27 18:13 UTC, Andrey V. Henneberg
no flags Details
File: smolt_data (3.01 KB, application/octet-stream)
2012-11-27 18:13 UTC, Andrey V. Henneberg
no flags Details
the bug reproducer (15.14 KB, application/zip)
2012-11-27 19:42 UTC, Andrey V. Henneberg
no flags Details
catalog-parser.php (3.06 KB, text/plain)
2012-11-28 09:11 UTC, Remi Collet
no flags Details


Links
System ID Private Priority Status Summary Last Updated
PHP Bug Tracker 63635 0 None None None Never

Description Andrey V. Henneberg 2012-11-27 18:12:41 UTC
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

Comment 1 Andrey V. Henneberg 2012-11-27 18:12:45 UTC
Created attachment 652987 [details]
File: backtrace

Comment 2 Andrey V. Henneberg 2012-11-27 18:12:47 UTC
Created attachment 652988 [details]
File: build_ids

Comment 3 Andrey V. Henneberg 2012-11-27 18:12:50 UTC
Created attachment 652989 [details]
File: cgroup

Comment 4 Andrey V. Henneberg 2012-11-27 18:12:53 UTC
Created attachment 652990 [details]
File: core_backtrace

Comment 5 Andrey V. Henneberg 2012-11-27 18:12:55 UTC
Created attachment 652991 [details]
File: dso_list

Comment 6 Andrey V. Henneberg 2012-11-27 18:12:57 UTC
Created attachment 652992 [details]
File: environ

Comment 7 Andrey V. Henneberg 2012-11-27 18:13:00 UTC
Created attachment 652993 [details]
File: limits

Comment 8 Andrey V. Henneberg 2012-11-27 18:13:02 UTC
Created attachment 652994 [details]
File: maps

Comment 9 Andrey V. Henneberg 2012-11-27 18:13:05 UTC
Created attachment 652995 [details]
File: open_fds

Comment 10 Andrey V. Henneberg 2012-11-27 18:13:08 UTC
Created attachment 652996 [details]
File: proc_pid_status

Comment 11 Andrey V. Henneberg 2012-11-27 18:13:10 UTC
Created attachment 652997 [details]
File: var_log_messages

Comment 12 Andrey V. Henneberg 2012-11-27 18:13:15 UTC
Created attachment 652998 [details]
File: smolt_data

Comment 13 Remi Collet 2012-11-27 18:31:11 UTC
*** Bug 880516 has been marked as a duplicate of this bug. ***

Comment 14 Remi Collet 2012-11-27 18:31:33 UTC
*** Bug 880718 has been marked as a duplicate of this bug. ***

Comment 15 Remi Collet 2012-11-27 18:42:21 UTC
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) ?

Comment 16 Andrey V. Henneberg 2012-11-27 19:36:18 UTC
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

Comment 17 Andrey V. Henneberg 2012-11-27 19:42:06 UTC
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.

Comment 18 Remi Collet 2012-11-27 19:46:30 UTC
So, no more crash.

> PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted...
You just need to increase the limit.

Comment 19 Andrey V. Henneberg 2012-11-27 20:47:14 UTC
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.

Comment 20 Remi Collet 2012-11-28 09:08:22 UTC
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).

Comment 21 Remi Collet 2012-11-28 09:11:35 UTC
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.

Comment 22 Remi Collet 2012-11-28 11:21:15 UTC
Bug reported upstream with a "minimal" reproducer.
https://bugs.php.net/63635

So, closing this one as UPSTREAM.


Note You need to log in before you can comment on or make changes to this bug.