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

flutter: error:连接失败:SocketException: Connection failed (OS Error: Too many open files, errno = 24) #14

Open
vera-byte opened this issue Dec 1, 2023 · 0 comments

Comments

@vera-byte
Copy link
Contributor

经过Debug不断排查最终锁定问题====>跟踪到此文件_WKSocket类

class _WKSocket
package:wukongimfluttersdk/manager/connect_manager.dart

_socket 不是单列模式 在每次发生异常都会调用_socketConnect 每次调用都会覆盖原有的_socket,而覆盖的时候_socket实列依然存在导致之前的实列也会重复调用,重连次数越多Socket会实列就越多,最终超出连接池限制
image
最终修改为单列模式解决实列问题
查看监控平台可得知这一个客户端永远只有一个连接(达到预期)
单列模式后listen会出现问题 Bad state: Stream has already been listened to 这意味着_socket.listen 已经处于监听中,但又没找到remove移除监听 最终加了一个变量来跟踪监听状态 _isListening

vera-byte added a commit to vera-byte/WuKongIMFlutterSDK that referenced this issue Dec 1, 2023
No8blackball added a commit that referenced this issue Dec 3, 2023
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

1 participant