Comments (21)
没有使用taskpool,直接在poller里面进行了一次nbiotcp.Write,按道理不会卡死?
from nbio.
用Shutdown试试。
from nbio.
提供下可复现的代码
from nbio.
我最近有点忙,闲了看
from nbio.
复现代码可能要等下周,目前已知就是在nbhttp.Parser.Read里面触发了Parser.Close,导致了死锁,nbhttp默认是用taskpool工作,可能平时不会发生,我是直接在poller里面执行函数
复现过程就是,大量新建wss连接,然后突然关闭客户端
from nbio.
我想想要不要给bio.Conn多加个mutex给Execute队列单独使用,否则这种io协程上不跨协程直接执行逻辑队列onclose确实不好弄。但poller协程上直接进行逻辑处理要注意避免阻塞比如请求下游http或者rpc或者数据库等其他阻塞操作
from nbio.
目前看只有onclose会这样,我认为可以把onclose放入taskpool运行,一般来说不会有问题,这样改的比较少
from nbio.
Onclose也要保证顺序,所以是用nbio.Conn.Execute放到Conn队列里去执行,这里默认就是用的taskpool但你定制后没有走协程池了
from nbio.
直接在engine调用onclose的地方go去执行倒是可以解决onclose本身,但可能还会有其他死锁
from nbio.
可以测下试试
from nbio.
你本地在这里加个go试试:
https://github.com/lesismal/nbio/blob/master/poller_epoll.go#L103
from nbio.
好,我试试
from nbio.
跑了几天,问题依旧,可能还有别的地方触发
from nbio.
在websocket.Conn.handleProtocolMessage也会触发close
奇怪,我确定已经在 deleteConn 加了go语句,为何还会死锁
from nbio.
还是用协程池吧,如果不想协程数量太多,把协程池size设小点就行了
from nbio.
Line 240 in 9d2ae1d
把这个改成
go c.Conn.Close()
应该可以解决,考虑到可能破坏原来的设计**,看能不能加一个配置,用户选择是否异步执行?
from nbio.
这样看上去不太美丽,你们用size较小的协程池会有什么问题吗?
from nbio.
业务只是非常薄的一次wss->tcp转发,用异步处理感觉不划算
from nbio.
就用默认的协程池可以的不
from nbio.
如果在线量不是非常大,标准库同步方案延迟更低
from nbio.
嗯,我考虑一下
from nbio.
Related Issues (20)
- 如何增加序列化和反序列化的函数? HOT 3
- how to use with so reuseport option for the http example? HOT 3
- one more question. thx for the prompt reply, how well does it scale as a client? HOT 7
- just tested the performance of nbio tcp https on multicore system. it's great! but... how to do h2? HOT 1
- am i asking for a lot? pushing for tcp performance and nbios hit the mark but... HOT 18
- curious about the "total success" HOT 28
- how to increase the eventloop from the tls server example? HOT 5
- only 2,000 req/s with redis client example but using tls server example modification, i can get 25,000 req/s. what's wrong? HOT 2
- 请教大佬,在很短的时间里,向同一个conn推送多次数据 HOT 8
- 使用udp发送数据,会存在丢包! HOT 14
- Retract v1.5.4 HOT 6
- how to set so reuseport option for server? HOT 3
- 1.5.6 仍可能存在潜在bug HOT 31
- What is the principle of realizing 10 million connections to a single server? HOT 2
- WS客户端发送超高压缩率内容,可导致服务器OOM HOT 15
- onClose 没有调用 HOT 2
- InsecureSkipVerify=false的时候,无法进行TLS连接 HOT 7
- 请教下关于二进制数据压缩的问题 HOT 3
- LetsEncrypt HOT 1
- 大佬有交流群吗 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nbio.