Comments (4)
这个 swoole 扩展抛出的错误,源码 https://learnku.com/articles/16908/analysis-of-swoole-source-code-queue-queue-of-basic-module ,我这里重现不出来,你使用的 swoole 是什么版本。
from mix.
swoole版本信息:
swoole
Swoole => enabled
Author => Swoole Team <[email protected]>
Version => 4.2.13
Built => Feb 3 2019 23:16:24
coroutine => enabled
kqueue => enabled
rwlock => enabled
pcre => enabled
zlib => enabled
brotli => enabled
async_redis => enabled
Directive => Local Value => Master Value
swoole.display_errors => On => On
swoole.enable_coroutine => On => On
swoole.fast_serialize => Off => Off
swoole.unixsock_buffer_size => 262144 => 262144
swoole.use_shortname => On => On
php 版本
PHP 7.3.1 (cli) (built: Jan 10 2019 13:15:37) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.1, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.1, Copyright (c) 1999-2018, by Zend Technologies
mix版本
const VERSION = '1.1.1';
*问题出现的时机为:*左进程向中进程发送信息$worker->send($data)
时出现该问题
复现方式:
1.在task/InputQueue
的push
方法下方添加如下内容,当字符串为数组
长度为1
的序列化时,没问题
public function push($data)
{
// 重启信号处理
if ($this->isLeftWorker() && ($this->isRestart() || $this->isStopLeft())) {
if (parent::push($data)) {
$this->worker->exit();
}
}
// 投递数据
// $data = "";
print('data');
$data = <<<data
a:1:{i:0;O:16:"MQ\Model\Message":9:{s:16:"*receiptHandle";s:93:"2F630CC85E5C3D4EAC69389B9775013B-OSAxNTQ5OTAwMTIwOTU5IDMwMDAwMCA3IDAgaHotc2hhcmUyLTAzIDEgOQ==";s:14:"*publishTime";s:13:"1549900120949";s:18:"*nextConsumeTime";s:13
:"1549900420959";s:19:"*firstConsumeTime";s:13:"1549900120959";s:16:"*consumedTimes";s:1:"1";s:9:"messageId";s:32:"2F630CC85E5C3D4EAC69389B9775013B";s:14:"messageBodyMD5";s:32:"8D7B3DF974943E802F6C4D70D2293D3B";s:11:"messageBody";s:738:"{"db"
:{"uid":"100033","app_id":"100270","url":"http:\/\/www.kancloud.cn\/manual\/thinkphp5_1\/354102","title":"\u4eca\u5929\u8fd8\u6ca1\u6709\u7b7e\u5230\u54e6\uff0c\u4e0d\u8981\u5fd8\u8bb0\u4e86\u554a","description":"\u6cd5\u5e08\u6253\u53d1\u65a
f\u8482\u82ac","tid":"100028","push_description":"\u8fd9\u91cc\u63a8\u9001\u63cf\u8ff0"},"push":{"uid":"100033","app_id":"100270","url":"http:\/\/www.kancloud.cn\/manual\/thinkphp5_1\/354102","title":"\u5de5\u4f5c\u901a\u77e5:\u6cb3\u5357\u77
01\u7b2c\u4e00\u4eba\u6c11\u533b\u9662","description":"[\u7b7e\u5230]\u4eca\u5929\u8fd8\u6ca1\u6709\u7b7e\u5230\u54e6\uff0c\u4e0d\u8981\u5fd8\u8bb0\u4e86\u554a","tid":"100028","push_description":"\u8fd9\u91cc\u63a8\u9001\u63cf\u8ff0"},"versio
n":"1"}";s:10:"messageTag";N;}}
data;
return parent::push($data);
}
2.当字符串为数组
长度为2
的序列化时,出现上方描述的错误
// 投递数据
public function push($data)
{
// 重启信号处理
if ($this->isLeftWorker() && ($this->isRestart() || $this->isStopLeft())) {
if (parent::push($data)) {
$this->worker->exit();
}
}
// 投递数据
// $data = "";
print('data');
$data = <<<data
a:2:{i:0;O:16:"MQ\Model\Message":9:{s:16:"*receiptHandle";s:93:"2F630B0D5D5C3D4EAC69389B8EFC009F-MTAgMTU0OTkwMDEyMDA4NyAzMDAwMDAgMyAwIGh6LXNoYXJlMi0wNCAzIDEw";s:14:"*publishTime";s:13:"1549900118780";s:18:"*nextConsumeTime";s:13
:"1549900420087";s:19:"*firstConsumeTime";s:13:"1549900120087";s:16:"*consumedTimes";s:1:"1";s:9:"messageId";s:32:"2F630B0D5D5C3D4EAC69389B8EFC009F";s:14:"messageBodyMD5";s:32:"8D7B3DF974943E802F6C4D70D2293D3B";s:11:"messageBody";s:738:"{"db"
:{"uid":"100033","app_id":"100270","url":"http:\/\/www.kancloud.cn\/manual\/thinkphp5_1\/354102","title":"\u4eca\u5929\u8fd8\u6ca1\u6709\u7b7e\u5230\u54e6\uff0c\u4e0d\u8981\u5fd8\u8bb0\u4e86\u554a","description":"\u6cd5\u5e08\u6253\u53d1\u65a
f\u8482\u82ac","tid":"100028","push_description":"\u8fd9\u91cc\u63a8\u9001\u63cf\u8ff0"},"push":{"uid":"100033","app_id":"100270","url":"http:\/\/www.kancloud.cn\/manual\/thinkphp5_1\/354102","title":"\u5de5\u4f5c\u901a\u77e5:\u6cb3\u5357\u77
01\u7b2c\u4e00\u4eba\u6c11\u533b\u9662","description":"[\u7b7e\u5230]\u4eca\u5929\u8fd8\u6ca1\u6709\u7b7e\u5230\u54e6\uff0c\u4e0d\u8981\u5fd8\u8bb0\u4e86\u554a","tid":"100028","push_description":"\u8fd9\u91cc\u63a8\u9001\u63cf\u8ff0"},"versio
n":"1"}";s:10:"messageTag";N;}i:1;O:16:"MQ\Model\Message":9:{s:16:"*receiptHandle";s:93:"792BCECC6D5A3D4EAC69389B92570138-MTAgMTU0OTkwMDEyMDA4NyAzMDAwMDAgMyAwIGh6LXNoYXJlMi0wNCAwIDEw";s:14:"*publishTime";s:13:"1549900119639";s:18:"*nextConsum
eTime";s:13:"1549900420087";s:19:"*firstConsumeTime";s:13:"1549900120087";s:16:"*consumedTimes";s:1:"1";s:9:"messageId";s:32:"792BCECC6D5A3D4EAC69389B92570138";s:14:"messageBodyMD5";s:32:"8D7B3DF974943E802F6C4D70D2293D3B";s:11:"messageBody";s
:738:"{"db":{"uid":"100033","app_id":"100270","url":"http:\/\/www.kancloud.cn\/manual\/thinkphp5_1\/354102","title":"\u4eca\u5929\u8fd8\u6ca1\u6709\u7b7e\u5230\u54e6\uff0c\u4e0d\u8981\u5fd8\u8bb0\u4e86\u554a","description":"\u6cd5\u5e08\u6253
\u53d1\u65af\u8482\u82ac","tid":"100028","push_description":"\u8fd9\u91cc\u63a8\u9001\u63cf\u8ff0"},"push":{"uid":"100033","app_id":"100270","url":"http:\/\/www.kancloud.cn\/manual\/thinkphp5_1\/354102","title":"\u5de5\u4f5c\u901a\u77e5:\u6cb
3\u5357\u7701\u7b2c\u4e00\u4eba\u6c11\u533b\u9662","description":"[\u7b7e\u5230]\u4eca\u5929\u8fd8\u6ca1\u6709\u7b7e\u5230\u54e6\uff0c\u4e0d\u8981\u5fd8\u8bb0\u4e86\u554a","tid":"100028","push_description":"\u8fd9\u91cc\u63a8\u9001\u63cf\u8ff
0"},"version":"1"}";s:10:"messageTag";N;}}
data;
return parent::push($data);
}
from mix.
使用以下命令:
ipcs -l
查看你的 linux 的 ipc 的限制信息,由于系统默认消息限制为 8192:
------ Messages Limits --------
max queues system wide = 651
max size of message (bytes) = 8192
default max size of queue (bytes) = 16384
------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 18014398509465599
max total shared memory (kbytes) = 18014398442373116
min seg size (bytes) = 1
------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32
semaphore max value = 32767
所以框架对大于 8000 的消息就做了本地文件缓存,你的系统可能限制是小于 2468,因此导致消息 push 失败。
from mix.
@onanying 谢谢了,可以工作了,mac好像改不了,我把框架长度修改到了2048,不会报错了,谢谢
from mix.
Related Issues (20)
- Redis-subscribe 支持 prefix 否? HOT 1
- 没有对mysql保留关键字做反引号处理 HOT 1
- 2.2版本 UDP服务器会重复执行处理接收到的数据 HOT 2
- 官网无法访问 HOT 2
- 数据量较多时,json_decode可能会失败 HOT 7
- PDO执行使用问号占位符的原生SQL报错 HOT 2
- 建议项目遵从语义化版本来维护版本号 HOT 1
- PHP用ip curl post请求 会卡1秒 HOT 5
- 新版本性能严重下降 HOT 6
- table方法传入表名order报错 HOT 1
- 验证器场景设置optional未生效 HOT 3
- Coroutine中同时使用Channel和Database pool导致出错 HOT 5
- mix-skeleton使用context()->get('guzzle') 报错 HOT 1
- php8RC3-swoole4.5.6 运行出错 HOT 1
- or and 查找抛出异常 HOT 1
- Upgrade to Zipkin 2.0 HOT 1
- log组件报错 HOT 1
- 推送模式卡死 HOT 1
- 如何正确的提交 PR
- V3 启动事务后 lastInsertId 值不正确 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mix.