swoft-cloud / swoft

🚀 PHP Microservice Full Coroutine Framework
https://swoft.org
Apache License 2.0
5.58k stars 786 forks source link

wsServer.setting.dispatch_mode = 1 轮询模式 Session::mustGet() session information has been lost of the SID: 1 #878

Closed vvphp closed 5 years ago

vvphp commented 5 years ago
Q A
Bug report? yes
Feature request? yes
Swoft version 2.0.4-beta
Swoole version 4.4.3-alpha
PHP version 7.3.7
Runtime environment Mac Docker etc.

Details bean.php wsServer.setting.dispatch_mode = 1 轮询模式

--onMessage--9031---------2019/08/05-10:32:20 [ERROR] Swoft\Error\DefaultExceptionHandler:handle(36) (DEFAULT HANDLER)Exception(Swoft\Exception\SessionException): session information has been lost of the SID: 1 At File /www/wwwroot/swoft2/vendor/swoft/framework/src/Session/Session.php line 126 Trace:

0 /www/wwwroot/swoft2/vendor/swoft/websocket-server/src/WsMessageDispatcher.php(46): Swoft\Session\Session::mustGet()

1 /www/wwwroot/swoft2/vendor/swoft/websocket-server/src/Swoole/MessageListener.php(60): Swoft\WebSocket\Server\WsMessageDispatcher->dispatch(Object(Swoole\WebSocket\Server), Object(Swoole\WebSocket\Frame))

2 {main}

感觉是work之前session数据的问题,是这我没配置对吗?

bean.php wsServer.setting.dispatch_mode = 2 FD取模 默认的没有的这个问题。

for ($i=0;$i<=100;$i++){
        $cli->push("home.af:aaa:bbb");
}

```php
// paste code
inhere commented 5 years ago

image

https://wiki.swoole.com/wiki/page/277.html

tcp, ws, rpc 这样的不要使用 mode 1 !!!

vvphp commented 5 years ago

好的,谢谢!