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

ZMQ freezes when receiving data

Open JKRT opened this issue 6 years ago • 7 comments

Send and recv is currently handled by

function sendExpression(omc, expr)
   ZMQ.send(omc.socket, expr)
   message=ZMQ.recv(omc.socket)
   return Parser.parseOM(unsafe_string(message))
end

The issue here is that I have managed to freeze it a couple of times (The reason being is that we have ZMQ communication but we do not have any timeout or polling to make the decision to throw a communication error and terminate).

This permanently blocks OMJulia and you need to quit the application. It is possible to use polling or timeout techniques to prevent this behavior. If someone else thinks that could be a good addition I could implement it :)

JKRT avatar Jun 12 '19 08:06 JKRT

@JKRT adding a timeout is a good option , OMPython also uses timeout mechanism to connect with omc, but not in the sendExpression(), i did not face any such freeze situation in OMJulia, but we can add a timeout parameter in the sendExpression() method, but hopefully timeout value should not be very short

arun3688 avatar Jun 12 '19 08:06 arun3688

@arun3688 I noticed it when I tried some things (I am one of those people who do weird things). Basically, I put a lot of print statements for debugging in the Compiler and that broke OMJulia.. See if I can replicate the issue. However, as you said from just reading the code one can imagine the issue even if it is rare..

Do you know anything about usage patterns for OMJulia? I guess certain things can indeed take a very long time hmm.. Some kind of polling option would be the best I guess?

JKRT avatar Jun 12 '19 13:06 JKRT

I currently do not have the time to do work on this. It is not really critical but I leave it open should either of us have the time

JKRT avatar Aug 19 '19 14:08 JKRT

@JKRT , I will start looking into it once i finished with OMMatlab Linearization API

arun3688 avatar Aug 19 '19 14:08 arun3688

It is not really a big issue. Just do it if there is nothing else to do. As we discussed we should look into the same thing for OMPython as well, and maybe even OMMatlab since the same issue might occur there

JKRT avatar Aug 19 '19 14:08 JKRT

sure

arun3688 avatar Aug 19 '19 14:08 arun3688

Seems alright. My only comment is that we maybe should do import ZMQ instead of using ZMQ so we can see which parts that belongs to different modules

JKRT avatar Sep 13 '19 15:09 JKRT