Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mailbox.TryRead still throwing in debug mode #1092

Open
tmatthey opened this issue May 16, 2024 · 0 comments
Open

Mailbox.TryRead still throwing in debug mode #1092

tmatthey opened this issue May 16, 2024 · 0 comments

Comments

@tmatthey
Copy link

Environment

NetMQ Version:    4.0.1.13 with [PR 1087](https://github.com/zeromq/netmq/pull/1087) debug mode
Operating System:  Alpine Linux
.NET Version:   standard 2.0  

Expected behaviour

Mailbox.TryRead should not throw when returning a command for debug mode.

Actual behaviour

When run in debug mode Debug.Assert(ok); may throw since m_commandPipe.TryRead may return false:

Process terminated. Assertion failed.
   at NetMQ.Core.Mailbox.TryRecv(Int32 timeout, Command& command)
   at NetMQ.Core.SocketBase.ProcessCommands(Int32 timeout, Boolean throttle, CancellationToken cancellationToken)
   at NetMQ.Core.SocketBase.GetSocketOptionX(ZmqSocketOption option)
   at NetMQ.NetMQSocket.GetSocketOptionX[T](ZmqSocketOption option)
   at NetMQ.NetMQSocket.get_HasIn()

Steps to reproduce the behaviour

A one-off on Alpine Linux, most probably when DNS disappears.

How to potentially fix

Remove Debug.Assert(ok);, just return value of m_commandPipe.TryRead. I'm not certain if caller of Mailbox.TryRead may check if command.Destination to be not zero when processing the command, i.e., reading a command with CommandType.Done sent by ZObject.SendDone(), which has no destination.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant