Make sure you read Issues Guideline and answer these questions before submitting your issue. Thanks!
(Any non-English issues will be closed immediately.)
Please provide your PHP and Swoole version. (php -v and php --ri swoole)
php -v
PHP 7.4.14 (cli) (built: Jan 12 2021 02:34:49) ( ZTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
php --ri swoole
swoole
Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 4.6.1
Built => Feb 7 2021 00:55:40
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 1.1.1d 10 Sep 2019
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
pcre => enabled
zlib => 1.2.11
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
async_redis => enabled
Directive => Local Value => Master Value
swoole.display_errors => On => On
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.unixsock_buffer_size => 8388608 => 8388608
swoole.use_shortname => On => On
I'm using swoole on Docker.
Here is my Dockerfile
FROM php:7.4.14-zts
RUN apt -y update && \
apt-get install -y \
libicu-dev \
libonig-dev \
libzip-dev \
libmagick++-dev \
libmagickwand-dev \
libpq-dev \
libmemcached-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
libwebp-dev \
libxpm-dev \
git \
npm \
default-jre \
libxml2-dev \
libcurl4-openssl-dev \
libssl-dev
RUN docker-php-ext-install -j$(nproc) pdo_mysql
RUN docker-php-ext-install -j$(nproc) intl
RUN docker-php-ext-install -j$(nproc) zip
RUN docker-php-ext-install -j$(nproc) sockets
RUN pecl install igbinary && docker-php-ext-enable igbinary
RUN pecl install parallel && docker-php-ext-enable parallel
# Install redis manually because we need enable to igbinary
RUN pecl install --onlyreqdeps --nobuild redis && \
cd "$(pecl config-get temp_dir)/redis" && \
phpize && \
./configure --enable-redis-igbinary && \
make && make install && \
docker-php-ext-enable redis
RUN git clone https://github.com/swoole/swoole-src.git && \
cd swoole-src && \
git checkout v4.6.1 && \
phpize && \
./configure --enable-sockets --enable-http2 --enable-openssl --enable-swoole-curl --enable-swoole-json && \
make -j$(nproc) && \
make install && \
docker-php-ext-enable swoole
RUN pecl install memcached && docker-php-ext-enable memcached
RUN pecl install imagick && docker-php-ext-enable imagick
RUN pecl install xdebug
RUN docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/
RUN docker-php-ext-install -j$(nproc) gd
RUN docker-php-ext-install -j$(nproc) soap
// ... omitted
What did you do? If possible, provide a recipe for reproducing the error.
I tried to use the go function on a controller but it is not working.
Here is my code:
public function index(Request $request)
{
\Swoole\Runtime::enableCoroutine();
$wg = new \Swoole\Coroutine\WaitGroup();
go(function () use ($wg) {
var_dump(1);
$wg->add();
\Co::sleep(3);
$wg->done();
var_dump(2);
});
go(function () use ($wg) {
var_dump(1);
$wg->add();
\Co::sleep(3);
$wg->done();
var_dump(2);
});
$wg->wait();
}
it will show var_dump messages on the console but swoole will be crashed.
int(1)
int(1)
int(2)
[2021-02-07 12:42:53 $56.0] WARNING check_worker_exit_status: worker#12[pid=85] abnormal exit, status=0, signal=11
A bug occurred in Swoole-v4.6.1, 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/blob/master/.github/ISSUE.md
Please do not send bug reports in the mailing list or personal letters.
The issue page is also suitable to submit feature requests.
And I tried to use barrier class but it is not working.
public function index(Request $request)
{
\Swoole\Runtime::enableCoroutine();
$barrier = \Swoole\Coroutine\Barrier::make();
go(function () use ($barrier) {
var_dump(1);
\Co::sleep(3);
var_dump(2);
});
go(function () use ($barrier) {
var_dump(1);
\Co::sleep(3);
var_dump(2);
});
\Swoole\Coroutine\Barrier::wait($barrier);
}
it will show var_dump messages completely on the console but swoole will be crashed.
int(1)
int(1)
int(2)
int(2)
it will show the same message.
[2021-02-07 12:48:50 $54.0] WARNING check_worker_exit_status: worker#11[pid=82] abnormal exit, status=0, signal=11
A bug occurred in Swoole-v4.6.1, 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/blob/master/.github/ISSUE.md
Please do not send bug reports in the mailing list or personal letters.
The issue page is also suitable to submit feature requests.
What did you expect to see?
I wanna use the go function on controllers, models, and so on.
Make sure you read Issues Guideline and answer these questions before submitting your issue. Thanks! (Any non-English issues will be closed immediately.)
php -v
andphp --ri swoole
)php -v
php --ri swoole
I'm using swoole on Docker. Here is my Dockerfile
I tried to use the go function on a controller but it is not working.
Here is my code:
it will show var_dump messages on the console but swoole will be crashed.
And I tried to use barrier class but it is not working.
it will show var_dump messages completely on the console but swoole will be crashed.
it will show the same message.
I wanna use the go function on controllers, models, and so on.