[root@2121d596e844 server]# php test.php PHP Fatal error: Uncaught Swoole\Error: can not create server after using async file operation in /root/codeDir/phpCode/swoole/server/test.php:17 Stack trace: #0 /root/codeDir/phpCode/swoole/server/test.php(17): Swoole\Server->start() #1 {main} thrown in /root/codeDir/phpCode/swoole/server/test.php on line 17
Fatal error: Uncaught Swoole\Error: can not create server after using async file operation in /root/codeDir/phpCode/swoole/server/test.php:17 Stack trace: #0 /root/codeDir/phpCode/swoole/server/test.php(17): Swoole\Server->start() #1 {main} thrown in /root/codeDir/phpCode/swoole/server/test.php on line 17 [2020-04-14 01:55:25 @52968.0] ERROR php_swoole_server_rshutdown (ERRNO 503): Fatal error: Uncaught Swoole\Error: can not create server after using async file operation in /root/codeDir/phpCode/swoole/server/test.php:17 Stack trace: #0 /root/codeDir/phpCode/swoole/server/test.php(17): Swoole\Server->start() #1 {main} thrown in /root/codeDir/phpCode/swoole/server/test.php on line 17 [root@2121d596e844 server]#
可以看到,这里报了一个错误:
1 2 3
can not create server after using async file operation
Coroutine::create(function () { $client = new Client(SWOOLE_SOCK_TCP); $client->connect('localhost', 8088); });
$serv->on('Receive', function () { });
$serv->start();
执行结果如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
[root@2121d596e844 server]# php test.php PHP Fatal error: Uncaught Swoole\Error: can not create server after using async file operation in /root/codeDir/phpCode/swoole/server/test.php:17 Stack trace: #0 /root/codeDir/phpCode/swoole/server/test.php(17): Swoole\Server->start() #1 {main} thrown in /root/codeDir/phpCode/swoole/server/test.php on line 17
Fatal error: Uncaught Swoole\Error: can not create server after using async file operation in /root/codeDir/phpCode/swoole/server/test.php:17 Stack trace: #0 /root/codeDir/phpCode/swoole/server/test.php(17): Swoole\Server->start() #1 {main} thrown in /root/codeDir/phpCode/swoole/server/test.php on line 17 [2020-04-14 02:01:16 @56567.0] ERROR php_swoole_server_rshutdown (ERRNO 503): Fatal error: Uncaught Swoole\Error: can not create server after using async file operation in /root/codeDir/phpCode/swoole/server/test.php:17 Stack trace: #0 /root/codeDir/phpCode/swoole/server/test.php(17): Swoole\Server->start() #1 {main} thrown in /root/codeDir/phpCode/swoole/server/test.php on line 17 [root@2121d596e844 server]#
pid_tswoole_fork(int flags) { if (!(flags & SW_FORK_EXEC)) { if (swoole_coroutine_is_in()) { swFatalError(SW_ERROR_OPERATION_NOT_SUPPORT, "must be forked outside the coroutine"); } if (SwooleTG.aio_init) { swFatalError(SW_ERROR_OPERATION_NOT_SUPPORT, "can not create server after using async file operation"); } } // 省略其他代码 }