Comments (1)
Bug已经复现。
为什么只有PoolSegManager才有Bug?
因为只有PoolSegManager的PoolSegManager.Seg是class,才会出现空引用。
怀疑的两个可能性:
1:TryRecv()的 rcv_queue.Count == 0 判断后,var seq = rcv_queue[0]; 执行前,存在其他线程删除了rcv_queue中的元素。
Q:通过代码分析,删除元素只有 UncheckRecv(Span buffer) 中 rcv_queue.RemoveRange(0, count); 一处。并且只在Recv环节调用,并不存在多线程问题。
2: https://source.dot.net/#System.Private.CoreLib/List.cs,203 rcv_queue.Add(seg);环节,是先增加size,后对下标赋值。
是不是有可能,rcv_queue.Count == 0 判断,var seq = rcv_queue[0]; 正好在List.Add中间执行?
直觉上这种可能性很小,但也不是没有。
一个佐证,但不能确定。在rcv_queue.Count == 0 判断,var seq = rcv_queue[0];两句代码之间插入了日志。Console.WriteLine($"rcv_queue TryRecv正在检测 rcv_queue[0]{rcv_queue[0]} ManagedThreadId{System.Threading.Thread.CurrentThread.ManagedThreadId}");
Bug消失了。
为什么sleep/delay 1 不出现Bug?
测试用例中如果delay,正好可以将Add和Recv函数错开调用。
from kcp.
Related Issues (20)
- 发生了数据损坏的现象 HOT 3
- 请教rcv_queue的数据结构问题 HOT 2
- 在收发消息的时候,segment频繁地在非托管堆申请和释放内存,导致频繁地在用户态和内核态切换,占用很高的CPU HOT 11
- 有加入FEC的计划吗? HOT 1
- 能不能提供udp和kcp结合起来的例子呢 HOT 4
- 大佬,在多个线程里调用Update会报错:无法访问已经释放的对象 HOT 5
- 如何连接指定的IP地址?
- 示例中两个客户端连接一个伺服器会发生延迟或丢包? HOT 5
- 没什么运行指南吗,VS打开都直接报错 HOT 3
- rcv_queue 创建buffer和UncheckRecv拷贝数据时有几率会造成越界 HOT 7
- 已发送的数据包在超过dead_link仍在尝试继续发送 HOT 2
- 可能出现了数据虚报长度? HOT 4
- 2个客户端请求一个服务器时有一个客户端不会收到消息 HOT 6
- 关于UnsafeSegManager疑似错误分配内存的问题 HOT 4
- 非托管的GC表现如何?可以做到0GC吗? HOT 4
- 流模式
- 请教作者一些问题 HOT 2
- compatibility with kcp-go HOT 1
- 有没有udp 服务端的实现吗? HOT 1
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 kcp.