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

monitor docs warn about "random crashes" but do not explain, how to avoid #185

Open
chrbsg opened this issue May 12, 2022 · 0 comments
Open

Comments

@chrbsg
Copy link
Contributor

chrbsg commented May 12, 2022

Quote from https://pkg.go.dev/github.com/pebbe/zmq4 :

func (*Socket) Monitor ¶
func (soc *Socket) Monitor(addr string, events Event) error
Register a monitoring callback.

See: http://api.zeromq.org/4-1:zmq-socket-monitor#toc2

WARNING: Closing a context with a monitoring callback will lead to random crashes. This is a bug in the ZeroMQ library. The monitoring callback has the same context as the socket it was created for.

It would be helpful if the comment could be expanded to explain and give instructions on how to avoid random crashes.

Is the context an explicit Go context type, or does "context" mean the socket being monitored?

Does the developer need to call Close() on the PAIR monitor socket before calling Close() on the socket that is being monitored? (i.e. the problem occurs when the monitor socket is active but the socket being monitored is closed?)

Will the bug be triggered by runs of the example code, in which the monitor goroutine only exits the RecvEvent loop when RecvEvent returns err!=nil, or is the example code ok to use as a base for actual monitoring?

Is there an upstream reference for this bug? Or is it a "working as designed" issue, where developers are expected to write code in a certain way to not trigger a crash?

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