Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v4.2.13-Segmentation fault (core dumped) #2829

Closed
codezm opened this issue Sep 12, 2019 · 6 comments
Closed

v4.2.13-Segmentation fault (core dumped) #2829

codezm opened this issue Sep 12, 2019 · 6 comments

Comments

@codezm
Copy link

codezm commented Sep 12, 2019

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provide a simple script for reproducing the error.
    public function do() {
        go(function() {
            $data = $this->coGet('http://mbd.baidu.com/newspage/data/landingsuper?context=%7B%22nid%22%3A%22news_9943521182000235196%22%7D&n_type=0&p_from=1');
            echo '<pre>'; var_dump($data); echo '</pre>';
        });
    }

    /**
     * Swoole 协程 Get 请求
     *
     */
    public function coGet($request_url, $request_data = [], $timeout = null){

        $parseUrls = parse_url($request_url);
        $port = ($parseUrls['scheme'] == 'https' ? 443 : 80);
        $ssl = ($parseUrls['scheme'] == 'https' ? true : false);

        $cocroutineClient = new Client($parseUrls['host'], $port, $ssl);
        $cocroutineClient->set(['timeout' => $timeout ?? -1]);

        $cocroutineClient->get($parseUrls['path'] . '?' . http_build_query($request_data));
        $result = $cocroutineClient->body;
        $cocroutineClient->close();

        return $result;
    }

bash-4.4# php test-swoole-coroutine-http-client.php
Segmentation fault (core dumped)

Type "apropos word" to search for commands related to "word"...
Reading symbols from php...(no debugging symbols found)...done.
[New LWP 65733]
[New LWP 65737]
[New LWP 65736]
[New LWP 65735]
[New LWP 65734]

warning: Can't read pathname for load map: No error information.
btCore was generated by `php test-swoole-coroutine-http-client.php'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000055b07d4fb070 in zend_hash_str_find ()
[Current thread is 1 (LWP 65733)]
(gdb) bt
#0 0x000055b07d4fb070 in zend_hash_str_find ()
#1 0x00007f14009663a4 in coro_http_tick (frame=0x7f1400638d00, context=0x7f14006389c0) at /src/swoole-apm/apm_intercept.c:2565
#2 0x00007f14009620b4 in apm_execute_core (internal=internal@entry=1 '\001', execute_data=execute_data@entry=0x7f1401675390, return_value=return_value@entry=0x7f1400638e90) at /src/swoole-apm/apm.c:1947
#3 0x00007f1400963c70 in apm_execute_internal (execute_data=0x7f1401675390, return_value=0x7f1400638e90) at /src/swoole-apm/apm.c:2052
#4 0x000055b07d57c64a in ?? ()
#5 0x000055b07d52e09b in execute_ex ()
#6 0x00007f1400963a49 in apm_execute_ex (execute_data=0x7f1401675130) at /src/swoole-apm/apm.c:1998
#7 0x000055b07d57c334 in ?? ()
#8 0x000055b07d52e09b in execute_ex ()
#9 0x00007f1400963a49 in apm_execute_ex (execute_data=0x7f14016750a0) at /src/swoole-apm/apm.c:1998
#10 0x00007f1401244108 in swoole::PHPCoroutine::create_func (arg=) at /tmp/swoole-new/swoole_coroutine.cc:281
#11 0x00007f14011fd6db in swoole::Context::context_func (arg=0x55b07e25bf78) at /tmp/swoole-new/src/coroutine/context.cc:87
#12 0x00007f14012af041 in make_fcontext () at /tmp/swoole-new/thirdparty/boost/asm/make_x86_64_sysv_elf_gas.S:64
#13 0x0000000000000000 in ?? ()
2. What did you expect to see?

Swoole\Coroutine\Http\Client

  1. What did you see instead?

Segmentation fault (core dumped)

  1. What version of Swoole are you using (show your php --ri swoole)?

swoole

Swoole => enabled
Author => Swoole Team team@swoole.com
Version => 4.2.13
Built => Sep 12 2019 16:09:23
coroutine => enabled
epoll => enabled
eventfd => enabled
signalfd => enabled
spinlock => enabled
rwlock => enabled
zlib => enabled
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
async_redis => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.fast_serialize => Off => Off
swoole.unixsock_buffer_size => 8388608 => 8388608

  1. What is your machine environment used (including version of kernel & php & gcc) ?

NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.9.4
PRETTY_NAME="Alpine Linux v3.9"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"

PHP 7.1.20 (cli) (built: Jun 27 2019 14:39:00) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies

gcc (Alpine 8.3.0) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@twose
Copy link
Member

twose commented Sep 12, 2019

@codezm 首先感谢您的BUG反馈, 我是无情的自动回复机器人,请您快速确认以下几点来帮助我们定位您的问题:

  1. 如你是手动升级编译的而不是首次编译, 确保你在编译前运行make clean清理了上次编译的内容

  2. 如你使用的是Linux系统, 使用以下命令运行你的程序, 以能够复现BUG的方式操作你的程序, 并在程序运行一定时间后, 将位于/tmp目录的valgrind.log日志内容贴在此issue中

USE_ZEND_ALLOC=0 valgrind --log-file=/tmp/valgrind.log php xxx.php
  1. 如你使用的是macOS系统,将无法使用valgrind, 请提供能够复现问题BUG的PHP代码

  2. 若以上需求都无法满足,请您在此表明, 我们将快速接入人工处理

@codezm
Copy link
Author

codezm commented Sep 12, 2019

==65777== Memcheck, a memory error detector
==65777== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==65777== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==65777== Command: php test-swoole-coroutine-http-client.php
==65777== Parent PID: 24
==65777==
==65777== Conditional jump or move depends on uninitialised value(s)
==65777== at 0x404FC29: strlcpy (in /lib/ld-musl-x86_64.so.1)
==65777== by 0x6C6275702F656C6E: ???
==65777== by 0x612F6B64732F6368: ???
==65777== by 0x2E64616F6C6F7474: ???
==65777==
==65777== Warning: client switching stacks? SP change: 0x1ffeffcd20 --> 0x69efff8
==65777== to suppress, use: --max-stackframe=137311079720 or greater
==65777== Warning: client switching stacks? SP change: 0x1ffeffe250 --> 0x69eec70
==65777== to suppress, use: --max-stackframe=137311090144 or greater
==65777== Warning: client switching stacks? SP change: 0x1ffeffe670 --> 0x69eed00
==65777== to suppress, use: --max-stackframe=137311091056 or greater
==65777== further instances of this message will not be shown.
==65777== Use of uninitialised value of size 8
==65777== at 0x61D070: zend_hash_str_find (in /usr/local/bin/php)
==65777== by 0x5F9C3A3: coro_http_tick (apm_intercept.c:2565)
==65777== by 0x5F980B3: apm_execute_core (apm.c:1947)
==65777== by 0x5F99C6F: apm_execute_internal (apm.c:2052)
==65777== by 0x69E649: ??? (in /usr/local/bin/php)
==65777== by 0x65009A: execute_ex (in /usr/local/bin/php)
==65777== by 0x5F99A48: apm_execute_ex (apm.c:1998)
==65777== by 0x69E333: ??? (in /usr/local/bin/php)
==65777== by 0x65009A: execute_ex (in /usr/local/bin/php)
==65777== by 0x5F99A48: apm_execute_ex (apm.c:1998)
==65777== by 0x5846107: swoole::PHPCoroutine::create_func(void*) (swoole_coroutine.cc:281)
==65777== by 0x57FF6DA: swoole::Context::context_func(void*) (context.cc:87)
==65777==
==65777== Invalid read of size 4
==65777== at 0x61D070: zend_hash_str_find (in /usr/local/bin/php)
==65777== by 0x5F9C3A3: coro_http_tick (apm_intercept.c:2565)
==65777== by 0x5F980B3: apm_execute_core (apm.c:1947)
==65777== by 0x5F99C6F: apm_execute_internal (apm.c:2052)
==65777== by 0x69E649: ??? (in /usr/local/bin/php)
==65777== by 0x65009A: execute_ex (in /usr/local/bin/php)
==65777== by 0x5F99A48: apm_execute_ex (apm.c:1998)
==65777== by 0x69E333: ??? (in /usr/local/bin/php)
==65777== by 0x65009A: execute_ex (in /usr/local/bin/php)
==65777== by 0x5F99A48: apm_execute_ex (apm.c:1998)
==65777== by 0x5846107: swoole::PHPCoroutine::create_func(void*) (swoole_coroutine.cc:281)
==65777== by 0x57FF6DA: swoole::Context::context_func(void*) (context.cc:87)
==65777== Address 0xc is not stack'd, malloc'd or (recently) free'd
==65777==
==65777==

@codezm
Copy link
Author

codezm commented Sep 16, 2019

[2019-09-16 09:28:01 $51.0]	WARNING	swManager_check_exit_status: worker#0 abnormal exit, status=0, signal=11
A bug occurred in Swoole-v4.2.13, please report it.
The Swoole developers probably don't know about it,
and unless you report it, chances are it won't be fixed.
You can read How to report a bug doc before submitting any bug reports:
>> https://github.com/swoole/swoole-src/issues/2000
Please do not send bug reports in the mailing list or personal letters.
The issue page is also suitable to submit feature requests.

@twose
Copy link
Member

twose commented Sep 16, 2019

SwooleTracker扩展的问题, 已转交处理, 可以先关闭Tracker扩展

@twose twose closed this as completed Sep 16, 2019
@codezm
Copy link
Author

codezm commented Sep 16, 2019

请问如何关闭 Tracker 扩展? 是编译参数 --enable-trace-log 吗?

@sy-records
Copy link
Member

请问如何关闭 Tracker 扩展? 是编译参数 --enable-trace-log 吗?

php --ini找到你加载的swoole_tracker扩展,注释掉就行了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants