Skip to content

Error With Sentry client (curl) in Coroutine context #377

@loloajax

Description

@loloajax

Hi, here is a code of a basic OpenSwoole HTTP server coupled with Sentry composer library to trace issues :

`

\OpenSwoole\Runtime::enableCoroutine(true, \OpenSwoole\Runtime::HOOK_ALL);
Coroutine::set([
    'max_concurrency' => 1000,
    'max_coroutine' => 1000,
    'hook_flags' => \OpenSwoole\Runtime::HOOK_ALL,
]);

\Sentry\init([
    'dsn' => "SENTRY_URL",
]);

$server = new \OpenSwoole\Http\Server("localhost", 8081);
$server->on("workerStart", function () {
    go(function () {
        $foo .= "";
    });
});
$server->on("request", function () {
});
$server->start();

`

I intentionally produced a Notice error $foo .= "" and the Sentry event is correctly sent.
However, it produces a segfault error, probably due to the Sentry curl request in the coroutine context:

WARNING Server::check_worker_exit_status(): worker(pid=29002, id=0) abnormal exit, status=0, signal=11
A bug occurred in OpenSwoole-v25.2.0, please report it.
Please submit bug report at:

https://github.com/openswoole/swoole-src/issues

OS: Darwin 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:22:00 PST 2025; root:xnu-11215.81.4~3/RELEASE_X86_64 x86_64
GCC_VERSION: Apple LLVM 16.0.0 (clang-1600.0.26.6)
OPENSSL_VERSION: OpenSSL 3.4.1 11 Feb 2025
PHP_VERSION : 8.3.19

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions