环境:
- Win10 + WSL1 (Ubuntu 18.04.3 LTS)
- php7.3 / 7.4 / 8
- swoole 4.6.7
- easyswoole 3.4.6
问题: 启动easyswoole时触发socket错误
[2021-07-29 10:54:35][debug][error]:[EasySwoole\Task\Worker bind /Projects/Test/TE001/WebApp/src/daemon/Temp/EasySwoole.TaskWorker.0.sock fail case Invalid argument at file:/Projects/Test/TE001/WebApp/src/vendor/easyswoole/component/src/Process/Socket/AbstractUnixProcess.php line:32]
[2021-07-29 10:54:35][debug][error]:[EasySwoole\Task\Worker bind /Projects/Test/TE001/WebApp/src/daemon/Temp/EasySwoole.TaskWorker.1.sock fail case Invalid argument at file:/Projects/Test/TE001/WebApp/src/vendor/easyswoole/component/src/Process/Socket/AbstractUnixProcess.php line:32]
[2021-07-29 10:54:35][debug][error]:[EasySwoole\Task\Worker bind /Projects/Test/TE001/WebApp/src/daemon/Temp/EasySwoole.TaskWorker.2.sock fail case Invalid argument at file:/Projects/Test/TE001/WebApp/src/vendor/easyswoole/component/src/Process/Socket/AbstractUnixProcess.php line:32]
[2021-07-29 10:54:35][debug][error]:[EasySwoole\Task\Worker bind /Projects/Test/TE001/WebApp/src/daemon/Temp/EasySwoole.TaskWorker.3.sock fail case Invalid argument at file:/Projects/Test/TE001/WebApp/src/vendor/easyswoole/component/src/Process/Socket/AbstractUnixProcess.php line:32]
PHP Fatal error: Uncaught EasySwoole\Component\Process\Exception: EasySwoole\Bridge\BridgeProcess bind /Projects/Test/TE001/WebApp/src/daemon/Temp/bridge.sock fail case Invalid argument in /Projects/Test/TE001/WebApp/src/vendor/easyswoole/component/src/Process/Socket/AbstractUnixProcess.php:32
Stack trace:
#0 /Projects/Test/TE001/WebApp/src/vendor/easyswoole/bridge/src/BridgeProcess.php(24): EasySwoole\Component\Process\Socket\AbstractUnixProcess->run()
#1 /Projects/Test/TE001/WebApp/src/vendor/easyswoole/component/src/Process/AbstractProcess.php(149): EasySwoole\Bridge\BridgeProcess->run()
#2 {main}
thrown in /Projects/Test/TE001/WebApp/src/vendor/easyswoole/component/src/Process/Socket/AbstractUnixProcess.php on line 32
Fatal error: Uncaught EasySwoole\Component\Process\Exception: EasySwoole\Bridge\BridgeProcess bind /Projects/Test/TE001/WebApp/src/daemon/Temp/bridge.sock fail case Invalid argument in /Projects/Test/TE001/WebApp/src/vendor/easyswoole/component/src/Process/Socket/AbstractUnixProcess.php:32
Stack trace:
#0 /Projects/Test/TE001/WebApp/src/vendor/easyswoole/bridge/src/BridgeProcess.php(24): EasySwoole\Component\Process\Socket\AbstractUnixProcess->run()
#1 /Projects/Test/TE001/WebApp/src/vendor/easyswoole/component/src/Process/AbstractProcess.php(149): EasySwoole\Bridge\BridgeProcess->run()
#2 {main}
thrown in /Projects/Test/TE001/WebApp/src/vendor/easyswoole/component/src/Process/Socket/AbstractUnixProcess.php on line 32
PHP Fatal Error 'yii\base\ErrorException' with message 'Uncaught EasySwoole\Component\Process\Exception: EasySwoole\Bridge\BridgeProcess bind /Projects/Test/TE001/WebApp/src/daemon/Temp/bridge.sock fail case Invalid argument in /Projects/Test/TE001/WebApp/src/vendor/easyswoole/component/src/Process/Socket/AbstractUnixProcess.php:32
Stack trace:
#0 /Projects/Test/TE001/WebApp/src/vendor/easyswoole/bridge/src/BridgeProcess.php(24): EasySwoole\Component\Process\Socket\AbstractUnixProcess->run()
#1 /Projects/Test/TE001/WebApp/src/vendor/easyswoole/component/src/Process/AbstractProcess.php(149): EasySwoole\Bridge\BridgeProcess->run()
#2 {main}
thrown'
in /Projects/Test/TE001/WebApp/src/vendor/easyswoole/component/src/Process/Socket/AbstractUnixProcess.php:32
排查:
- 不同php 版本测试,仍触发相同错误
- 不同swoole 版本测试,仍触发相同错误
- 不同easyswoole版本测试,仍触发相同错误
- 放入真Ubuntu测试,没出现问题,于是怀疑WSL导致
解决方法:
- 更新windows
- 升级到WSL2
- easyswoole配置中的 'TEMP_DIR' => '/tmp'
参考:
- https://docs.microsoft.com/zh-cn/windows/wsl/compare-versions