Bug #75351 [NEW]: Segmentation fault on fatal error during Generator::send
| From: | bashofmann at gmail dot com | Date: | Tue, 10 Oct 2017 15:15:47 +0000 |
| Subject: | Bug #75351 [NEW]: Segmentation fault on fatal error during Generator::send | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-211610@lists.php.net to get a copy of this message | ||
From: bashofmann at gmail dot com
Operating system: Ubuntu 14.04.5 LTS (GNU/Linux 4.
PHP version: 7.1.10
Package: *Programming Data Structures
Bug Type: Bug
Bug description:Segmentation fault on fatal error during Generator::send
Description:
------------
We are experiencing segmentation faults related to probably fatal errors
when using Generator::send. Unfortunately I was not able to create a
simple script to reproduce this issue.
gdb back trace:
(gdb) bt
#0 calc_gc_buffer_size (generator=0x7f64d68f4a80) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_generators.c:279
#1 zend_generator_get_gc (object=0x7ffe4c963eb0, table=0x7ffe4c963ea8,
n=0x7ffe4c963ea4) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_generators.c:305
#2 0x00005576280aa23a in gc_mark_grey (ref=0x7f64d68f4a80) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_gc.c:499
#3 0x00005576280aa2b6 in gc_mark_grey (ref=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_gc.c:511
#4 0x00005576280aa2b6 in gc_mark_grey (ref=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_gc.c:511
#5 0x00005576280aa346 in gc_mark_grey (ref=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_gc.c:572
#6 0x00005576280aa346 in gc_mark_grey (ref=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_gc.c:572
#7 0x00005576280ab1e8 in gc_mark_roots () at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_gc.c:598
#8 zend_gc_collect_cycles () at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_gc.c:1072
#9 0x00005576280aae3e in gc_possible_root (ref=0x7ffe4c963eb0,
ref@entry=0x7f64d68f5f80) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_gc.c:286
#10 0x00005576280af551 in zend_object_release (obj=0x7f64d68f5f80) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_objects_API.h:80
#11 zend_generator_update_current
(generator=generator@entry=0x7f64d68f4a80, leaf=0x7f64d68f4a80) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_generators.c:667
#12 0x00005576280aefdd in zend_generator_get_current
(generator=0x7f64d68f4a80) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_generators.h:133
#13 zend_generator_resume
(orig_generator=orig_generator@entry=0x7f64d68f4a80) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_generators.c:845
#14 0x00005576280afe7f in zim_Generator_send
(execute_data=0x7f6555a14070, return_value=0x7ffe4c964210) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_generators.c:1001
#15 0x000055762811a0cc in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:972
#16 0x00005576280c8edb in execute_ex (ex=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:429
#17 0x0000557628119f65 in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:949
#18 0x00005576280c8edb in execute_ex (ex=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:429
#19 0x0000557628119f65 in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:949
#20 0x00005576280c8edb in execute_ex (ex=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:429
#21 0x0000557628119f65 in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:949
#22 0x00005576280c8edb in execute_ex (ex=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:429
#23 0x0000557628119f65 in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:949
#24 0x00005576280c8edb in execute_ex (ex=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:429
#25 0x0000557628119ae5 in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:1076
#26 0x00005576280c8edb in execute_ex (ex=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:429
#27 0x0000557628119ae5 in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:1076
#28 0x00005576280c8edb in execute_ex (ex=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:429
#29 0x0000557628119f65 in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:949
#30 0x00005576280c8edb in execute_ex (ex=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:429
#31 0x00005576280aeede in zend_generator_resume
(orig_generator=0x7f64de060780) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_generators.c:815
#32 0x000055762811a0cc in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:972
#33 0x00005576280c8edb in execute_ex (ex=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:429
#34 0x0000557628119f65 in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:949
#35 0x00005576280c8edb in execute_ex (ex=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:429
#36 0x0000557628119ae5 in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:1076
#37 0x00005576280c8edb in execute_ex (ex=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:429
#38 0x00005576280747e1 in zend_call_function
(fci=fci@entry=0x7ffe4c964810, fci_cache=fci_cache@entry=0x7ffe4c9647e0)
at /build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_execute_API.c:855
#39 0x0000557627f762ad in reflection_method_invoke
(execute_data=<optimized out>, return_value=0x7f6555a13610, variadic=0)
at
/build/php7.1-zUmk8m/php7.1-7.1.9/ext/reflection/php_reflection.c:3342
#40 0x0000557628119c50 in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:1099
#41 0x00005576280c8edb in execute_ex (ex=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:429
#42 0x0000557628119ae5 in ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER () at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:1076
#43 0x00005576280c8edb in execute_ex (ex=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:429
#44 0x0000557628119f65 in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:949
#45 0x00005576280c8edb in execute_ex (ex=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:429
#46 0x0000557628119f65 in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:949
#47 0x00005576280c8edb in execute_ex (ex=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:429
#48 0x0000557628119f65 in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:949
#49 0x00005576280c8edb in execute_ex (ex=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:429
#50 0x0000557628119f65 in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:949
#51 0x00005576280c8edb in execute_ex (ex=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:429
#52 0x0000557628119f65 in ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER () at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:949
#53 0x00005576280c8edb in execute_ex (ex=<optimized out>) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:429
#54 0x000055762811bf74 in zend_execute (op_array=0x7f6555a67000,
op_array@entry=0x7f64f0edbe88,
return_value=return_value@entry=0x7f6555a13550) at
/build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend_vm_execute.h:474
#55 0x0000557628083e44 in zend_execute_scripts (type=type@entry=8,
retval=0x7f6555a13550, retval@entry=0x0, file_count=file_count@entry=3)
at /build/php7.1-zUmk8m/php7.1-7.1.9/Zend/zend.c:1480
#56 0x00005576280234a8 in php_execute_script
(primary_file=0x7ffe4c966f90) at
/build/php7.1-zUmk8m/php7.1-7.1.9/main/main.c:2552
#57 0x0000557627f0c4ac in main (argc=<optimized out>, argv=<optimized
out>) at /build/php7.1-zUmk8m/php7.1-7.1.9/sapi/fpm/fpm/fpm_main.c:1966
Excerpt of zbacktrace
(gdb) zbacktrace
[0x7f6555a14070] Generator->send(object[0x7f6555a140c0]) [internal
function]
[0x7f6555a13fd0]
rg\core\pow\preparer\handler\GeneratorHandler->returnResponse(object[0x7f6555a14020],
object[0x7f6555a14030], reference)
/home/researchgate/community/tor_prd/blue/src/core/pow/preparer/handler/GeneratorHandler.php:60
[0x7f6555a13f40]
rg\core\pow\preparer\handler\PreparableHandler->returnResponse(object[0x7f6555a13f90],
object[0x7f6555a13fa0], array(1)[0x7f6555a13fb0])
/home/researchgate/community/tor_prd/blue/src/core/pow/preparer/handler/PreparableHandler.php:82
...
the code of returnResponse in GeneratorHandler looks rather innocent:
public function returnResponse($preparable, \Traversable $iterator,
array $data) {
if (!is_array($iterator->rawCurrent()) && count($data) === 1) {
$data = reset($data);
}
$preparable->send($data);
}
The reason why I'm suspecting it has something to do with a fatal error
is that it seems to go through this line
https://github.com/php/php-src/blob/PHP-7.1.9/Zend/zend_generators.c#L133
in the bt
--
Edit bug report at https://bugs.php.net/bug.php?id=75351&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75351&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75351&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75351&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75351&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75351&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75351&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75351&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75351&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75351&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75351&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75351&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75351&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75351&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75351&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75351&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75351&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75351&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75351&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75351&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75351&r=mysqlcfg