fix deadlock in message serialization using fragmented mode#414
Conversation
Signed-off-by: Julian Linz <julianlinz10@gmail.com>
|
Hi @sneepy3, thanks for raising this issue and for taking the time to contribute a fix. I agree that the deadlock you described is real. However, I don’t think this change is safe in its current form. Releasing There is also a lock-state issue in the failure path. If I also don’t think the fix in That said, the issue itself is worth fixing, so I am happy to keep discussing the right design here. |
|
Hello @EugenioCollado, thank you very much for responding. Regarding your first concern: to my understanding (please correct me if I'm wrong), the flush_callback is triggered once the buffer is full, so if another thread would try to start a stream, it should return an error or initiate a flush aswell instead of overwriting the buffer? I totally agree with your second concern, but it could probably be addressed by locking again before returning. |
|
Hi again @sneepy3. Once And yes, I agree that reacquiring the lock before returning would fix the second issue. |
|
Thanks for the clarification. The only thing that I could come up with that does not significantly alter the current structure is wrapping the whole fragmented stream inside a session lock. Maybe you can come up with something better, as for my project, I can live with this solution. |
A deadlock can occur during serialization in multithreaded mode using message fragmentation.
This fix is similar to #303.