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

libc++abi.dylib: terminating with uncaught exception of type std::__1::system_error: thread constructor failed: Resource temporarily unavailable Abort trap: 6 #4202

Closed
Player626 opened this issue May 11, 2021 · 3 comments

Comments

@Player626
Copy link

Player626 commented May 11, 2021

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provide a simple script for reproducing the error.
<?php

\Swoole\Coroutine::create(function (){
    while (true) {
        \Swoole\Coroutine::create(function (){
           $client = new \Swoole\Coroutine\Http\Client('baidu.com',443,true);
           $client->get('/');
           var_dump($client->getStatusCode());
        });
    }
});
  1. What did you expect to see?

  2. What did you see instead?

libc++abi.dylib: terminating with uncaught exception of type std::__1::system_error: thread constructor failed: Resource temporarily unavailable Abort trap: 6
  1. What version of Swoole are you using (show your php --ri swoole)?

swoole

Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 4.6.6
Built => May  1 2021 14:02:28
coroutine => enabled with thread context
kqueue => enabled
rwlock => enabled
openssl => OpenSSL 1.1.1i  8 Dec 2020
dtls => enabled
http2 => enabled
pcre => enabled
zlib => 1.2.11
async_redis => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 262144 => 262144
  1. What is your machine environment used (show your uname -a & php -v & gcc -v) ?
PHP 7.4.13 (cli) (built: Dec 23 2020 16:02:05) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: arm64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Darwin shidizai-Mac-mini.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:06:51 PST 2021; root:xnu-7195.81.3~1/RELEASE_ARM64_T8101 arm64
@matyhtf
Copy link
Member

matyhtf commented May 15, 2021

Enable-thread-context is used, but the OS cannot create a new thread, so the creation of the coroutine fails.

@matyhtf
Copy link
Member

matyhtf commented May 15, 2021

Under the Linux platform, you can set /proc/sys/kernel/threads-max to adjust the maximum number of threads

@Player626
Copy link
Author

thank you

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

2 participants