1

I am getting the following stacktrace after SIGTERM (not SIGINT) event in a julia-0.4.7 script:

signal (15): Terminate
write at /lib64/libpthread.so.0 (unknown line)
unknown function (ip: 0x2ade16a02893)
uv_write2 at /path/to/home/julia/bin/../lib/julia/libjulia.so (unknown line)
jl_uv_write at /path/to/home/julia/bin/../lib/julia/libjulia.so (unknown line)
uv_write at ./stream.jl:951
buffer_or_write at ./stream.jl:972
write at ./stream.jl:1011
print at ./char.jl:47
unknown function (ip: 0x2ade1e06d0a2)
jl_apply_generic at /path/to/home/julia/bin/../lib/julia/libjulia.so (unknown line)
print at strings/io.jl:18
jl_apply_generic at /path/to/home/julia/bin/../lib/julia/libjulia.so (unknown line)
jl_f_apply at /path/to/home/julia/bin/../lib/julia/libjulia.so (unknown line)
println at strings/io.jl:25
jl_apply_generic at /path/to/home/julia/bin/../lib/julia/libjulia.so (unknown line)
anonymous at /path/to/home/test.jl:4
unknown function (ip: 0x2ade169c5b13)
unknown function (ip: 0x2ade169c672c)
jl_load at /path/to/home/julia/bin/../lib/julia/libjulia.so (unknown line)
include at ./boot.jl:261
jl_apply_generic at /path/to/home/julia/bin/../lib/julia/libjulia.so (unknown line)
include_from_node1 at ./loading.jl:333
jl_apply_generic at /path/to/home/julia/bin/../lib/julia/libjulia.so (unknown line)
process_options at ./client.jl:284
_start at ./client.jl:378
unknown function (ip: 0x2ade1e05ae79)
jl_apply_generic at /path/to/home/julia/bin/../lib/julia/libjulia.so (unknown line)
unknown function (ip: 0x401c87)
unknown function (ip: 0x40186f)
__libc_start_main at /lib64/libc.so.6 (unknown line)
unknown function (ip: 0x4018b5)

So, how do I catch it? Looks like sth is broken in my Julia binaries, isn't it? Is there a similar way to catch SIGTERM like for SIGINT? i.e.:

ccall(:jl_exit_on_sigint, Void, (Cint,), 0)
try
    ...
catch ex
    println("caught something")
    if isa(ex, InterruptException)
        println("it was an interrupt")
    end
end

I am using Cent-OS 6.5.

Fengyang Wang
  • 11,901
  • 2
  • 38
  • 67
frank
  • 103
  • 10

1 Answers1

0

Short answer: you can't, see here. The thing you reference, jl_exit_on_sigint is a C function written in julia/src/signal-handling.c. At present, they have not written a handler for SIGTERM, so adding your own handler would mean changing Julia's base, and they have not exposed any API for handling signals in general. This is largely because there isn't a way to have a consistent way of doing signal handling across threads without a large performance hit.

sujeet
  • 310
  • 2
  • 8