Home
Download
Document
Forum
Video
Donate
Source Code
AI 助理
Sponsors
CRMEB
Apipost
腾讯云
微擎
禅道
51Talk
Products
Swoole AI 智能文档翻译器
Swoole-Compiler PHP 代码加密器
CRMEB 新零售社交电商系统
Login
Register
全部
提问
分享
讨论
建议
公告
开发框架
CodeGalaxy
发表新帖
在webman中使用swoole一键协程化不生效
### 问题描述 在webman中使用swoole一键协程化不生效 ### Swoole版本,PHP版本,以及操作系统版本信息 swoole版本5.0.2 php版本8.1 操作系统:centos7 ### 相关代码 ```php //webman server.php 配置 return [ 'listen' => 'http://0.0.0.0:8787', 'transport' => 'tcp', 'context' => [], 'name' => 'webman', 'count' => cpu_count() * 10, 'user' => '', 'group' => '', 'reusePort' => false, 'event_loop' => Workerman\Events\Swoole::class, 'stop_timeout' => 2, 'pid_file' => runtime_path() . '/webman.pid', 'status_file' => runtime_path() . '/webman.status', 'stdout_file' => runtime_path() . '/logs/stdout.log', 'log_file' => runtime_path() . '/logs/workerman.log', 'max_package_size' => 10 * 1024 * 1024 ]; // 测试一键协程化 \Swoole\Runtime::enableCoroutine(SWOOLE_HOOK_ALL); go(function () { Db::select("select CONNECTION_ID(),SLEEP(30);"); }); ``` ### 你期待的结果是什么?实际看到的错误信息又是什么? 一键协程化生效 一键协程化不生效的错误信息如下: mysql: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. (SQL: select CONNECTION_ID(),SLEEP(30);) redis: Uncaught Swoole\Error: Socket#12 has already been bound to another coroutine#25, reading of the same socket in coroutine#29 at t he same time is not allowed in
发布于1年前 · 41 次浏览 · 来自
提问
hui2023
### 问题描述 在webman中使用swoole一键协程化不生效 ### Swoole版本,PHP版本,以及操作系统版本信息 swoole版本5.0.2 php版本8.1 操作系统:centos7 ### 相关代码 ```php //webman server.php 配置 return [ 'listen' => 'http://0.0.0.0:8787', 'transport' => 'tcp', 'context' => [], 'name' => 'webman', 'count' => cpu_count() * 10, 'user' => '', 'group' => '', 'reusePort' => false, 'event_loop' => Workerman\Events\Swoole::class, 'stop_timeout' => 2, 'pid_file' => runtime_path() . '/webman.pid', 'status_file' => runtime_path() . '/webman.status', 'stdout_file' => runtime_path() . '/logs/stdout.log', 'log_file' => runtime_path() . '/logs/workerman.log', 'max_package_size' => 10 * 1024 * 1024 ]; // 测试一键协程化 \Swoole\Runtime::enableCoroutine(SWOOLE_HOOK_ALL); go(function () { Db::select("select CONNECTION_ID(),SLEEP(30);"); }); ``` ### 你期待的结果是什么?实际看到的错误信息又是什么? 一键协程化生效 一键协程化不生效的错误信息如下: mysql: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. (SQL: select CONNECTION_ID(),SLEEP(30);) redis: Uncaught Swoole\Error: Socket#12 has already been bound to another coroutine#25, reading of the same socket in coroutine#29 at t he same time is not allowed in
赞
0
分享
收藏
提问
分享
讨论
建议
公告
开发框架
CodeGalaxy
评论
2023-04-24
Rango
webman 并支持协程,未适配协程容器
赞
0
回复
2023-04-24
Rango
回复
Rango
webman 不支持协程
赞
0
回复
微信公众号
热门内容
暂无回复的问答
- CodeGalaxy K3s 轻量集群节点之间如何实现负载均衡
- 关于openssl CURL WARNING swSSL_connect: SSL_connect(fd=69) failed. Error: error:141A318A:SSL routines:tls_process_ske_dhe:dh key too small[1|394]
- 多个模型如何进行事务异常回退?
- websocket开启wss报错
- 协程tcp服务器如何使用多进程?recv()方法接收信息,打印出来的pid一直是同一个。没用使用到多进程啊。