I have some code that works fine in Atom/Juno debugger but when I run it directly in Julia it goes in some sort of cycle and spins forever. Any ideas on how to debug such a thing? I have tried to attach to the julia process with gdb and look at the stack but that does’t help me too much. See one of the traces below, maybe somebody has some idea what’s going on.
I also have looked a the thread stack using Process Explorer and it seems to be doing some sort of type checking.
The code was translated automatically from a type safe language and then hand changed a bit to make it work, so it basically has type definitions for everything. Also, large structures are send around to most of the functions. As far as I can tell it seems to be some sort of type conversion going on but I don’t quite know where it comes from using the debugger tools available. As I said, it works fine in Juno so I can’t debug using that.
You can find two of the gdb traces here (I could not paste them here as it complained about post size):
When I can’t reproduce things in the debugger I usually fall back on logging. If you know the area that appears to be hanging add lots of logging there and reproduce.
The problem is that not even printouts are shown. When I call the main function it just hangs in there.
I wonder if it’s a compile issue…if you call:
precompile(main, (arg types))
Updated for your main function along with the argument types…does that return?
That seems to be the issue, is stuck at the call:
# 1 method for generic function "run":
 run() in Main.OMCompiler at C:\home\adrpo33\dev\julia\OMCompiler.jl\src\Main\all.jl:62
julia> precompile(Main.OMCompiler.run, ())
Any idea how to debug this one?
It just sits like that for hours and just gathers memory, I killed it at 5GB last time.
and that precompiles for about 15 minutes and then I call that.
You can see the code here:
Truth is that we have a lot of recursive module imports, maybe that’s the issue.
That is a lot of nested Modules–the Modelica background is obvious .
I tried installing it by dev’ing lots of packages, but I got stuck when it couldn’t find the Global package.
Global.jl is inside OMCompiler/src/Frontend/Global.jl
I only dev:
https://github.com/adrpo/OpenModelicaParser.jl (the parser only has the dlls for Windows, we could do Linux as well if needed)
And then just include the stuff in OMCompiler.jl.
We are working on fixing some of the recursive imports, hopefully this will be better soon.