Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workerman.log日志经常出现以下错误导致进程退出 #74

Open
yexueduxing opened this issue Mar 8, 2021 · 1 comment
Open

Comments

@yexueduxing
Copy link

yexueduxing commented Mar 8, 2021

topthink/think-worker版本为:v2.0.12
gateway版本为:v3.0.18
异常一:
unpack(): Type N: not enough input, need 4, have 1 in /xxx/vendor/workerman/gateway-worker/src/Protocols/GatewayProtocol.php:198
异常二:
unserialize(): Error at offset 0 of 136 bytes in /xxx/vendor/workerman/gateway-worker/src/Protocols/GatewayProtocol.php:211

@walkor
Copy link
Owner

walkor commented Mar 8, 2021

异常一看起来是 手动调用了 GatewayProtocol::decode()方法,传输的数据长度不够,框架流程应该是先调用input判断长度是否足够,足够才会调用decode,从报错看是直接调用了decode。看下你的代码是否有手动调用它,或者改了gatewayWorker源码。
异常二有可能和异常一有关,先定位异常一。
/xxx/vendor/workerman/gateway-worker/src/Protocols/GatewayProtocol.php:198 unpack返回失败时,记录下日志。
利用Excpetion把$buffer和调用栈记录下来,看下哪里调用的decode,记录方法类似

file_put_contents('/tmp/gateway.log', "buffer:$buffer" . (new Excpetion('GatewayProtocol')). "\n"), FILE_APPEND);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants