首页
下载
文档
社区
视频
捐赠
源代码
赞助商
AOT 编译器
AI 助理
商业产品
PHP AOT 原生编译器
Swoole-Compiler 代码加密器
CRMEB 新零售社交电商系统
登录
注册
全部
提问
分享
讨论
建议
公告
开发框架
CodeGalaxy
发表新帖
think-swoole用swoole5运行提示错误怎么解决
think-swoole用swoole5运行提示错误怎么解决 这是来自热更新提示的错误 ```shell [FATAL ERROR]: all coroutines (count: 1) are asleep - deadlock! ``` 差不多就是这个信息。 但是用swoole4版本提示 ```shell [2024-06-23 08:42:53 @19761.0] INFO reload workers ``` 这种信息 ```php // 整理了一下,基本就是下面这种代码 $pool = new Pool(2, 1, 0, true); $pool->on(Constant::EVENT_WORKER_START, function ($pool, $workerId) { Process::signal(SIGTERM, function () use ($pool) { $pool->getProcess()->exit(); }); if ($workerId == 0) { $http = new Server('0.0.0.0', 8000, false, true); $http->handle('/', function ($request, $response) use ($workerId) { Coroutine::create(function () use ($workerId, $response) { $response->end("1"); }); }); $http->start(); } else { Timer::tick(2000, function () use ($pool) { Process::kill($pool->master_pid, SIGUSR1); }); } }); $pool->start(); ```
发布于2年前 · 0 次浏览 · 来自
提问
think-swoole用swoole5运行提示错误怎么解决 这是来自热更新提示的错误 ```shell [FATAL ERROR]: all coroutines (count: 1) are asleep - deadlock! ``` 差不多就是这个信息。 但是用swoole4版本提示 ```shell [2024-06-23 08:42:53 @19761.0] INFO reload workers ``` 这种信息 ```php // 整理了一下,基本就是下面这种代码 $pool = new Pool(2, 1, 0, true); $pool->on(Constant::EVENT_WORKER_START, function ($pool, $workerId) { Process::signal(SIGTERM, function () use ($pool) { $pool->getProcess()->exit(); }); if ($workerId == 0) { $http = new Server('0.0.0.0', 8000, false, true); $http->handle('/', function ($request, $response) use ($workerId) { Coroutine::create(function () use ($workerId, $response) { $response->end("1"); }); }); $http->start(); } else { Timer::tick(2000, function () use ($pool) { Process::kill($pool->master_pid, SIGUSR1); }); } }); $pool->start(); ```
赞
0
收藏
提问
分享
讨论
建议
公告
开发框架
CodeGalaxy
登录
后参与评论
评论
2024-06-27
加了糖的格温
协程客户端不需要再handle中再新开一个协程,本身会用协程执行的
赞
0
回复