nauxliu / opencc4php

简繁体转换 PHP 扩展
MIT License
457 stars 86 forks source link

当待翻译字符串包含某些特殊字符时,会导致返回502异常 #24

Closed mmdtl closed 6 years ago

mmdtl commented 7 years ago

当待翻译字符串包含某些特殊字符时,会导致返回502异常。 会导致异常的代码示例如下: opencc_convert(urldecode('%E8'), $opencc); 无法通过try,catch捕获异常,php的异常日志为空,nginx的异常日志如下:

2017/01/03 02:01:43 [error] 3283#0: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 10.0.2.2, server: 127.0.0.1, request: "XXXXX", upstream: "fastcgi://127.0.0.1:9000", host: "xxxxxxxxx"

我的本地环境是:visualbox虚拟机,CentOS release 6.5 (Final),PHP 5.3.28 ,nginx 1.5.10

pkujhd commented 7 years ago

我在php7.0.3和php5.5.15上测试都通过,可能是coredump了吧, 看下dmesg或者把core打开看出在哪里了,还有一种可能性是,php超时了,process被php-fpm杀死了,你可以在php-fpm.log里看到日志

mmdtl commented 7 years ago

基本可以排除超时,因为错误是瞬间输出的。尝试打开了core,用gdb查看coredump时,可能由于本地缺少了许多debug组件,导致有效信息貌似只有下面几行:

Core was generated by `php test_opencc.php'. Program terminated with signal 11, Segmentation fault.

0 0x00007f46827a262f in __strlen_sse42 () from /lib64/libc.so.6

整个coredump文件比较大,有90多MB,如果需要完整文件,请指明传输方式