首页
下载
文档
问答社区
视频
捐赠
源代码
AI 助理
赞助商
CRMEB
Apipost
腾讯云
微擎
禅道
51Talk
商业产品
Swoole AI 智能文档翻译器
Swoole-Compiler PHP 代码加密器
CRMEB 新零售社交电商系统
登录
注册
全部
提问
分享
讨论
建议
公告
开发框架
CodeGalaxy
发表新帖
websocket一直报warning,无法关闭,业务却正常?
### 问题描述 log_file 每隔一13秒连续3秒输出这个 [2020-03-27 10:48:57 *78114.1] WARNING swSocket_write_blocking(:201): write 16 bytes failed, Error: Resource temporarily unavailable[11] [2020-03-27 10:48:58 *78114.1] WARNING swSocket_write_blocking(:201): write 16 bytes failed, Error: Resource temporarily unavailable[11] [2020-03-27 10:48:59 *78114.1] WARNING swSocket_write_blocking(:201): write 16 bytes failed, Error: Resource temporarily unavailable[11] [2020-03-27 10:49:12 *78114.1] WARNING swSocket_write_blocking(:201): write 16 bytes failed, Error: Resource temporarily unavailable[11] [2020-03-27 10:49:13 *78114.1] WARNING swSocket_write_blocking(:201): write 16 bytes failed, Error: Resource temporarily unavailable[11] [2020-03-27 10:49:14 *78114.1] WARNING swSocket_write_blocking(:201): write 16 bytes failed, Error: Resource temporarily unavailable[11] [2020-03-27 10:49:27 *78114.1] WARNING swSocket_write_blocking(:201): write 16 bytes failed, Error: Resource temporarily unavailable[11] [2020-03-27 10:49:28 *78114.1] WARNING swSocket_write_blocking(:201): write 16 bytes failed, Error: Resource temporarily unavailable[11] [2020-03-27 10:49:29 *78114.1] WARNING swSocket_write_blocking(:201): write 16 bytes failed, Error: Resource temporarily unavailable[11] ### php和swoole版本,代码运行平台等相关信息 PHP 7.2.24 (cli) (built: Mar 5 2020 16:58:04) ( NTS ) swoole-src-4.4.7 ### 相关代码 ```php 请将代码黏贴至此处(请勿用截图) $ws->set([ "daemonize"=>true, 'log_level' => SWOOLE_LOG_ERROR, 'trace_flags' => SWOOLE_TRACE_SERVER, "log_file"=> '/home/wwwroot/dengji/swoole.log', "max_conn" => 512, 'open_cpu_affinity' => 0,//用CPU亲和设置(在全异步非阻塞是可启用) 'worker_num' => 4,//和CPU核心一致 'heartbeat_check_interval '=>11,//和客户端的心跳检测,用于用户下线 'heartbeat_idle_time'=>23 ]); 开了个定时器 if(!$server->taskworker&&$id==1){ _LOG($server->taskworker); _LOG("开启定时器"); $server->tick(15000,function () use ($server){ // $closeFdArr = $server->heartbeat(true); $closeFdArr = $server->heartbeat(false); _LOG("TICK:当前待关闭人数数:".count($closeFdArr)."ids".join(",",$closeFdArr)); foreach($closeFdArr as $fd) { $closeRs = $server->close($fd); } }); _LOG("定时器开启结束"); } ### 你期待的结果是什么?实际看到的错误信息又是什么?
发布于4年前 · 3 次浏览 · 来自
提问
deepblue7
### 问题描述 log_file 每隔一13秒连续3秒输出这个 [2020-03-27 10:48:57 *78114.1] WARNING swSocket_write_blocking(:201): write 16 bytes failed, Error: Resource temporarily unavailable[11] [2020-03-27 10:48:58 *78114.1] WARNING swSocket_write_blocking(:201): write 16 bytes failed, Error: Resource temporarily unavailable[11] [2020-03-27 10:48:59 *78114.1] WARNING swSocket_write_blocking(:201): write 16 bytes failed, Error: Resource temporarily unavailable[11] [2020-03-27 10:49:12 *78114.1] WARNING swSocket_write_blocking(:201): write 16 bytes failed, Error: Resource temporarily unavailable[11] [2020-03-27 10:49:13 *78114.1] WARNING swSocket_write_blocking(:201): write 16 bytes failed, Error: Resource temporarily unavailable[11] [2020-03-27 10:49:14 *78114.1] WARNING swSocket_write_blocking(:201): write 16 bytes failed, Error: Resource temporarily unavailable[11] [2020-03-27 10:49:27 *78114.1] WARNING swSocket_write_blocking(:201): write 16 bytes failed, Error: Resource temporarily unavailable[11] [2020-03-27 10:49:28 *78114.1] WARNING swSocket_write_blocking(:201): write 16 bytes failed, Error: Resource temporarily unavailable[11] [2020-03-27 10:49:29 *78114.1] WARNING swSocket_write_blocking(:201): write 16 bytes failed, Error: Resource temporarily unavailable[11] ### php和swoole版本,代码运行平台等相关信息 PHP 7.2.24 (cli) (built: Mar 5 2020 16:58:04) ( NTS ) swoole-src-4.4.7 ### 相关代码 ```php 请将代码黏贴至此处(请勿用截图) $ws->set([ "daemonize"=>true, 'log_level' => SWOOLE_LOG_ERROR, 'trace_flags' => SWOOLE_TRACE_SERVER, "log_file"=> '/home/wwwroot/dengji/swoole.log', "max_conn" => 512, 'open_cpu_affinity' => 0,//用CPU亲和设置(在全异步非阻塞是可启用) 'worker_num' => 4,//和CPU核心一致 'heartbeat_check_interval '=>11,//和客户端的心跳检测,用于用户下线 'heartbeat_idle_time'=>23 ]); 开了个定时器 if(!$server->taskworker&&$id==1){ _LOG($server->taskworker); _LOG("开启定时器"); $server->tick(15000,function () use ($server){ // $closeFdArr = $server->heartbeat(true); $closeFdArr = $server->heartbeat(false); _LOG("TICK:当前待关闭人数数:".count($closeFdArr)."ids".join(",",$closeFdArr)); foreach($closeFdArr as $fd) { $closeRs = $server->close($fd); } }); _LOG("定时器开启结束"); } ### 你期待的结果是什么?实际看到的错误信息又是什么?
赞
0
分享
收藏
提问
分享
讨论
建议
公告
开发框架
CodeGalaxy
评论
2020-03-28
郭新华
别用heartbeat 方法 用配置吧,heartbeat 年久失修了
赞
0
回复
2020-03-29
郭新华
用最新的4.4lts分支已经修了
赞
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一直是同一个。没用使用到多进程啊。