-
Notifications
You must be signed in to change notification settings - Fork 58
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
Possible for ZMQ freezes when receiving data #95
Comments
I just hit this issue, too when trying to interrupt OMPython with Ctrl-C, which turns out to be impossible while it's waiting for a reply via the ZMQ socket. The problem is that a ZMQ Two solutions that are mentioned at https://stackoverflow.com/questions/17174001/stop-pyzmq-receiver-by-keyboardinterrupt are to add, in Before
or a bit more fancy (and probably cleaner):
which had the desired effect in some simple tests. I don't know if this needs to be fixed in other places in the codebase, too. |
MWE Python script for this problem (adapted from the example in the docs): from OMPython import OMCSessionZMQ
omc = OMCSessionZMQ()
print(omc.sendExpression("getVersion()"))
print(omc.sendExpression("cd()"))
omc.sendExpression("loadModel(Modelica)")
omc.sendExpression("loadFile(getInstallationDirectoryPath() + \"/share/doc/omc/testmodels/BouncingBall.mo\")")
omc.sendExpression("instantiateModel(BouncingBall)")
print('simulating')
omc.sendExpression("simulate(BouncingBall, stopTime=3.0)")
# Pressing Ctrl-C here does not interrupt omc
# the script will not finish anymore
# you have to kill the Python process to get out of this
print('finished') |
A similar issue to OpenModelica/OMJulia.jl#12 could occur here as @arun3688 pointed out. I leave this issue as an open issue here as well.
Some kind of polling should be implemented to prevent this
The text was updated successfully, but these errors were encountered: