OMJulia.jl
OMJulia.jl copied to clipboard
Debugging Julia with OMJulia gives ZMQ.StateError
Description
I'm using VS Code and the Julia extension to debug my Julia projects. When debugging code that also uses OMJulia I'm hitting errors I don't see when running the code without the debugger.
How to reproduce
When starting to debug a file with
using OMJulia
using OMJulia: sendExpression
omc = OMCSession()
sendExpression(omc, "loadModel(Modelica)")
sendExpression(omc, "simulate(Modelica.Electrical.Analog.Examples.CauerLowPassAnalog)")
sendExpression(omc, "quit()", parsed=false)
@error "Try to break before you hit me!"
I'm hitting an error in ZMQ.jl package:
Exception has occurred: ZMQ.StateError
ZMQ.StateError("Success")
Stacktrace:
[1] _recv!(socket::ZMQ.Socket, zmsg::ZMQ.Message)
@ ZMQ ~/.julia/packages/ZMQ/R3wSD/src/comm.jl:73
[2] recv(socket::ZMQ.Socket)
@ ZMQ ~/.julia/packages/ZMQ/R3wSD/src/comm.jl:94
[3] sendExpression(omc::OMJulia.OMCSession, expr::String; parsed::Bool)
@ OMJulia ~/workdir/julia/OMJulia.jl/src/OMJulia.jl:183
[4] sendExpression(omc::OMJulia.OMCSession, expr::String)
@ OMJulia ~/workdir/julia/OMJulia.jl/src/OMJulia.jl:180
[5] top-level scope
@ ~/workdir/julia/OMJulia.jl/bug.jl:6
I'm not sure if this is a ZMQ problem or the omc.socket from OMJulia is different when I'm debugging.
Without debugging
omc.socket = ZMQ.Socket(Ptr{Nothing} @0x0000000003818660, FileWatching._FDWatcher(Ptr{Nothing} @0x0000000003b9c910, 35, (1, 0), Base.GenericCondition{Base.Threads.SpinLock}(Base.InvasiveLinkedList{Task}(nothing, nothing), Base.Threads.SpinLock(0)), 0, (false, false)))
with debugging
omc.socket = ZMQ.Socket(Ptr{Nothing} @0x000000000305cce0, FileWatching._FDWatcher(Ptr{Nothing} @0x0000000002a8a950, 34, (1, 0), Base.GenericCondition{Base.Threads.SpinLock}(Base.InvasiveLinkedList{Task}(nothing, nothing), Base.Threads.SpinLock(0)), 0, (false, false)))
Versions 'n stuff
- OS: Ubuntu Focal
-
julia> versioninfo() Julia Version 1.8.1 Commit afb6c60d69a (2022-09-06 15:09 UTC) Platform Info: OS: Linux (x86_64-linux-gnu) CPU: 48 × Intel(R) Xeon(R) Gold 6248R CPU @ 3.00GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-13.0.1 (ORCJIT, cascadelake) Threads: 1 on 48 virtual cores - OMJulia v0.2.0 @d1e889924f0940dc9bbbc0bd13f676b1cb297151