When multiple threads are initializing the zmq context at the same time, this instance variable is not threadsafe. The resulting error will read Last ZMQ API call to socket_recv_string failed with "Context was terminated".
I am not sure if it is the responsibility of this gem to initialize the zmq context in a thread-safe manner or is the responsibility of an external caller. I will issue a PR if this should be fixed here.
Also, I can post a minimum viable reproduction if needed but but current reproduction in inside a web server I am testing. Happy to boil this down if someone picks this up.
Since the RPC server is part of this gem and that's what initializes the threads, I think we should fix it here. Are you thinking we should use a mutex?
When multiple threads are initializing the zmq context at the same time, this instance variable is not threadsafe. The resulting error will read
Last ZMQ API call to socket_recv_string failed with "Context was terminated"
.I am not sure if it is the responsibility of this gem to initialize the zmq context in a thread-safe manner or is the responsibility of an external caller. I will issue a PR if this should be fixed here.
Also, I can post a minimum viable reproduction if needed but but current reproduction in inside a web server I am testing. Happy to boil this down if someone picks this up.