Fixed issues #107 and #123, receiver check connection and when pop msg fail…#147
Fixed issues #107 and #123, receiver check connection and when pop msg fail…#147yonker-yk wants to merge 1 commit intomutouyun:masterfrom
Conversation
…d, and call reconnect function when the connection check result is false
|
非常感谢你的pr!但提交里有一些小问题。 Thank you very much for your pr! However, there are minor issues in the commit. The |
|
感谢作者指正,由于我的项目只使用了 NvN broadcast 模式,没有考虑到 unicast 模式的问题,我昨天看到你的单元测试检测出了这个异常 case,非常强!你的修改我同步下来验证了,没有问题哈,学习了,这个项目非常棒,再次感谢! Thank you, author, for pointing out the problem. Since I only used the NvN broadcast mode in my project and didn't consider the issues of the unicast mode, I saw that your unit test detected this exceptional case yesterday. It's really impressive! I synchronized and verified your modification, and there are no problems. I've learned a lot. This project is excellent. Thank you again! |
Fixed issues #107 and #123. The receiver now checks the connection status when popping a message fails, and calls the reconnect function if the connection check indicates that the connection is down. The root cause of the receiver's failure to pop a message is that the sender process invokes force_push() when it fails to push data into the circular queue. The force_push() function then identifies which receiver has not read the data and disconnects it. Typically, the receiver process hasn't read the data because it is either blocked (e.g., paused at a breakpoint) or stuck (when the system CPU load is high). Consequently, the receiver process has no way of knowing whether the connection was disconnected and will either wait on ::SignalObjectAndWait (when there is only one receiver in the connection) or endlessly retry popping the message.
Therefore, the solution involves making the receiver aware of disconnections so it can take action to recover, such as calling the reconnect() function. To achieve this, I have optimized the connect function and added reconnection logic in the recv() function. This approach has proven effective.