-
Notifications
You must be signed in to change notification settings - Fork 20
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
并发量大的时候经常发生错误 #18
Comments
创建客户端的时候opts参数传入['send_yield => true']即可解决 |
已传入 ['send_yield => true'] |
尝试复用同一个 stream ,然后使用write() 写入数据,问题解决 |
@twose 2、看了Http2客户端的文档,似乎还没支持send_yield,所以加了这个配置不生效。 |
send_yield是grpc客户端源码里自己实现的,不是Swoole提供的。 |
PHP Fatal error: Uncaught Swoole\Error: Socket#7 has already been bound to another coroutine#3, writing of the same socket in coroutine#2 at the same time is not allowed in /var/www/html/vendor/swoole/grpc/src/Grpc/Client.php:145
Stack trace:
#0 /var/www/html/vendor/swoole/grpc/src/Grpc/Client.php(145): Swoole\Coroutine\Http2\Client->recv(-1)
#1 {main}
thrown in /var/www/html/vendor/swoole/grpc/src/Grpc/Client.php 我在swoole/grpc这个包里没看到send_yield相关的代码,swoole/grpc的版本是1.0.3。 |
不对啊,你Swoole啥版本的,Swoole很早以前就支持同时读写,一读一写了 |
swoole
Swoole => enabled
Author => Swoole Team <[email protected]>
Version => 4.6.6
Built => Aug 4 2021 02:27:24
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
openssl => OpenSSL 1.1.0l 10 Sep 2019
dtls => enabled
http2 => enabled
zlib => 1.2.8
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
async_redis => enabled
Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608 4.6.6,这个版本应该是支持的一读一写的。然后我刚刚试了一下,把写协程放到读协程前面,这个报错是必现的。 |
这里底层实现有问题,因为recv的时候可能会触发帧更新,导致和写操作冲突了,我稍晚看看怎么解决一下 |
@twose 目前读写冲突的问题解决了吗?尝试了4.8.3问题还在 |
显示:
Fatal error: Uncaught Swoole\Error: Socket#33 has already been bound to another coroutine#852, writing of the same socket in coroutine#853 at the same time is not allowed in
The text was updated successfully, but these errors were encountered: