OMJulia.jl icon indicating copy to clipboard operation
OMJulia.jl copied to clipboard

Sometimes ZMQ freezes on sendExpression("quit()")

Open CSchoel opened this issue 6 years ago • 9 comments
trafficstars

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.

CSchoel avatar Sep 25 '19 10:09 CSchoel

@arun3688 Isn't it already fixed. See #12 and #29.

adeas31 avatar Sep 25 '19 15:09 adeas31

@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?

JKRT avatar Sep 25 '19 15:09 JKRT

@adeas31 , Yes this is fixed as John pointed it out, @CSchoel may be using the oder version

arun3688 avatar Sep 25 '19 16:09 arun3688

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 avatar Sep 25 '19 16:09 adeas31

@adeas31 i will add it

arun3688 avatar Sep 25 '19 17:09 arun3688

@arun3688 still, did you release a new version of OMJulia after the fix?

JKRT avatar Sep 26 '19 11:09 JKRT

@JKRT you mean which fix, this issue

arun3688 avatar Sep 26 '19 11:09 arun3688

@JKRT Did we cover this yesterday?

JKRT avatar Sep 27 '19 08:09 JKRT

@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.

CSchoel avatar Sep 30 '19 12:09 CSchoel