OMJulia.jl
OMJulia.jl copied to clipboard
Sometimes ZMQ freezes on sendExpression("quit()")
Sometimes (maybe 1 in 10 or 1 in 20 cases), ZMQ freezes after sendExpression(omc, "quit()").
The OMC instance shuts down properly, but the call never returns. I suppose that this could be a threading issue on the side of OMC so that quit() sometimes shuts down the process before the answer to the ZMQ message is sent.
The clean solution would probably be to look into the ZMQ handling in the OMC, but a quick fix could also be to simply skip the call to ZMQ.recv for the quit() message like this:
...
if expr == "quit()"
return ""
end
message=ZMQ.recv(omc.socket)
...
If it seems that this clutters up the implementation of sendExpression too much, it would also be possible to implement quit(omc) as a separate function.
@arun3688 Isn't it already fixed. See #12 and #29.
@arun3688 @adeas31 I think the issue might be due to the official version of this package has not been updated maybe..
@CSchoel Could you try the code from this repo and verify this to us?
@adeas31 , Yes this is fixed as John pointed it out, @CSchoel may be using the oder version
Well looking at the code I think the problem is still there. You only check for the process before send. If we send "quit()" it will kill the process so I think you have to check for it before receive as well.
@adeas31 i will add it
@arun3688 still, did you release a new version of OMJulia after the fix?
@JKRT you mean which fix, this issue
@JKRT Did we cover this yesterday?
@arun3688 @adeas31 I think the issue might be due to the official version of this package has not been updated maybe..
@CSchoel Could you try the code from this repo and verify this to us?
I already used the latest repository version (commit hash 77e7fe0684c8dc6b60cc668fcf1f2ec89c43581e) for my tests, because I needed the fix for #22 to be able to send the quit() command.
I think @adeas31 is right: The fix for #29 does not work in this case, because the omc process is killed after the process status was checked.