Skip to content
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

missing backtrace after task switch #13947

Closed
damiendr opened this issue Nov 11, 2015 · 6 comments
Closed

missing backtrace after task switch #13947

damiendr opened this issue Nov 11, 2015 · 6 comments
Labels
error handling Handling of exceptions by Julia or the user

Comments

@damiendr
Copy link
Contributor

Normal backtrace:

# file test.jl
try
    error("test")
catch e
    rethrow(e)
end
$ julia test.jl
ERROR: LoadError: test
 in test at test.jl:4
 in include at ./boot.jl:261
 in include_from_node1 at ./loading.jl:392
 in process_options at ./client.jl:277
 in _start at ./client.jl:377
while loading test.jl, in expression starting on line 10

Missing backtrace when using print in the catch block:

# file testprint.jl
try
    error("test")
catch e
    println("error")
    rethrow(e)
end
$ julia testprint.jl
error
ERROR: LoadError: test
while loading testprint.jl, in expression starting on line 5

Works fine when run from the REPL:

julia> include("testprint.jl")
error
ERROR: LoadError: test
 in error at ./error.jl:21
 in include at ./boot.jl:261
 in include_from_node1 at ./loading.jl:392
 in eval at ./boot.jl:264
while loading testprint.jl, in expression starting on line 5

Happens both in Julia 0.4 and the latest 0.5-dev.

@JobJob
Copy link

JobJob commented Nov 11, 2015

What OS are you using? I couldn't replicate on OSX

@damiendr
Copy link
Contributor Author

I get this behaviour on the following platforms (Note: the linux machine was accessed from the mac via ssh):

OSX 10.9.5
Julia Version 0.5.0-dev+1231
Commit f174d12* (2015-11-10 19:27 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin13.4.0)
  CPU: Intel(R) Core(TM) i7-2635QM CPU @ 2.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.3
Linux Mint (3.13.0)
Julia Version 0.4.0
Commit 0ff703b* (2015-10-08 06:20 UTC)
Platform Info:
  System: Linux (x86_64-linux-gnu)
  CPU: Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz
  WORD_SIZE: 64
  BLAS: libopenblas (NO_LAPACK NO_LAPACKE DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: liblapack.so.3
  LIBM: libopenlibm
  LLVM: libLLVM-3.3

It seems to be dependent on previous writes: adding println("hello") before the try...catch block in my example makes the backtrace appear. Conversely I've had backtraces disappear in situations where there were things printed before. Maybe a missing flush() or something?

@damiendr
Copy link
Contributor Author

In fact even adding println("") at the start makes the backtrace appear.

@JobJob
Copy link

JobJob commented Nov 11, 2015

Ok so I had some printing happening in my .juliarc.jl, when I disabled that I'm able to reproduce (on OSX) using this method above:

# file testprint.jl
try
    error("test")
catch e
    println("error")
    rethrow(e)
end

and similarly any printing before the try brings the backtrace back.

@vtjnash vtjnash changed the title missing backtrace after rethrow() when using print in catch block missing backtrace after task switch Nov 11, 2015
@damiendr
Copy link
Contributor Author

Also happens in cells of the IJulia notebook, one cell counting as one file of the above examples. Which is how I came across this bug, since cells are more likely than whole files to meet the conditions that trigger the bug.

@KristofferC
Copy link
Member

Closing in favour of #19979.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error handling Handling of exceptions by Julia or the user
Projects
None yet
Development

No branches or pull requests

4 participants