Swoole扩展运行时遇到zend_mm_heap corrupted的问题
今天在测试新代码时,突然报出一个zend_mm_heap corrupted。经过验证是因为 output_buffering=4096导致的。
关闭此选项或者在命令行执行export USE_ZEND_ALLOC=0后。不再出现。
PHP源代码中的坑还是挺多的。尤其是多线程模式下,有不少内存问题。
另外还遇到一个很奇怪的现象,在线程模式下Swoole C代码可稳定运行。Swoole PHP代码中运行多次后报一个内存错误,使用GDB定位,发现是函数指针错乱了。
#0 0x00000000006bfa8f in ?? ()
(gdb) bt
#0 0x00000000006bfa8f in ?? ()
#1 0x00000000006c1488 in zend_parse_parameters ()
#2 0x00007febb3feccb5 in zim_swoole_client_send (ht=<optimized out>, return_value=0xdfbee0 <executor_globals>,
return_value_ptr=<optimized out>, this_ptr=0x7febbe3d4a08, return_value_used=<optimized out>)
at /home/htf/workspace/ext_swoole/swoole.c:764
#3 0x0000000000000003 in ?? ()
#4 0x00007febbe39d290 in ?? ()
#5 0x000000000075ef52 in ?? ()
#6 0x0000000000718857 in execute ()
#7 0x00000000006a9da0 in zend_call_function ()
#8 0x00000000006aa0ee in call_user_function_ex ()
#9 0x00007febb3fed84f in zif_swoole_server_reload (ht=<optimized out>, return_value=0x7febbe3d3348,
return_value_ptr=<optimized out>, this_ptr=<optimized out>, return_value_used=<optimized out>)
at /home/htf/workspace/ext_swoole/swoole.c:452
#10 0x00007febbe3d3f70 in ?? ()
#11 0x00007febbe3d1b00 in ?? ()
#12 0x00007febbe3d3b30 in ?? ()
#13 0x00007febbe3d3348 in ?? ()
#14 0x0000000000000000 in ?? ()
目前还没找到原因。
分类: Swoole扩展