Open ABlueLight opened 2 years ago
Any advice on how to avoid this bug
anyone can offer help? Thanks
https://github.com/zeromq/libzmq/issues/4229 https://github.com/zeromq/libzmq/issues/3937
seem is the same reason
Not sure if this is still relevant, but leaving a comment just in case. I ran into this through the golang wrapper for this library (github.com/pebbe/zmq4
). I don't think there is a direct fix, but the cause of the issue in my case has been thread starvation which is likely the case in general. The Heartbeat interval and timeout values can help delay, but if your zmq thread starves it will trigger this assertion.
My suggestion for a "work-around" would be to review where things are blocking (i.e on mutexes), where threads are being launched, and when threads are being scheduled to try to ensure that any zmq socket threads never block for more than heartbeat duration.
@jmwample thanks for your suggestion
Please use this template for reporting suspected bugs or requests for help.
Issue description
when use ZMQ_PUB ZMQ_SUB and set heart_beat_timout maybe crash by _io_error error message Assertion failed: !_io_error (/home/users/jiangkuan.liu/tools/zeromq-4.3.4/src/stream_engine_base.cpp:331)
Environment
Minimal test code / Steps to reproduce the issue
1. Minimal test code
PUB code
SUB code
2. steps
first run sub program, and then run pub program if first run two sub programs, and then run pub program will be more easy to produce this error
if i set ZMQ_HEARTBEAT_TIMEOUT 0 or not set ZMQ_HEARTBEAT_TIMEOUT , it will not crash. if i set ZMQ_HEARTBEAT_TIMEOUT more large number, it will very difficult to create this bug i know set ZMQ_HEARTBEAT_TIMEOUT euqal to ZMQ_HEARTBEAT_IVL, and use a very small value is not normal, but it is just easy to create this bug. if i set reasonable ZMQ_HEARTBEAT_TIMEOUT and ZMQ_HEARTBEAT_IVL, it just very difficult to happen this bug, but it is also has possibility to create this bug.
What's the actual result? (include assertion message & call stack if applicable)
crash by assert failed _io_error
crash by assert failed _input_stoped
What's the expected result?
in this situation, it will not crash