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

piping output to less and quitting leads to missing exception handler #11876

Closed
kmsquire opened this issue Jun 26, 2015 · 5 comments
Closed

piping output to less and quitting leads to missing exception handler #11876

kmsquire opened this issue Jun 26, 2015 · 5 comments
Labels
domain:io Involving the I/O subsystem: libuv, read, write, etc. kind:bug Indicates an unexpected problem or unintended behavior

Comments

@kmsquire
Copy link
Member

I find that if I run a simple command in Julia, pipe the output to less, and quit less before Julia finishes, I get the following

$ julia -e 'for i=1:1000000; println(i); end' | less
ERROR: write: broken pipe (EPIPE)
 in yieldto at ./task.jl:21
 in wait at ./task.jl:309
 in stream_wait at ./stream.jl:289
 in uv_write at stream.jl:851
 in buffer_or_write at stream.jl:864
 in write at stream.jl:904
 in print at string.jl:5
 in print at string.jl:6
 in println at string.jl:8
 in println at stream.jl:242
 in anonymous at no file:1
 in process_options at ./client.jl:281
 in _start at ./client.jl:405
fatal: error thrown and no exception handler available.
Base.UVError(prefix="write", code=-32)
rec_backtrace at /Users/kmsquire/Source/julia/src/task.c:644
jl_switchto at /Users/kmsquire/Source/julia/usr/lib/libjulia.dylib (unknown line)
yieldto at ./task.jl:21
wait at ./task.jl:309
stream_wait at ./stream.jl:289
uv_write at stream.jl:851
buffer_or_write at stream.jl:864
write at stream.jl:904
println at string.jl:8
jl_apply at /Users/kmsquire/Source/julia/src/./julia.h:1260
jl_f_invoke at /Users/kmsquire/Source/julia/src/builtins.c:1065
println at stream.jl:242
jl_apply at /Users/kmsquire/Source/julia/src/gf.c:1632
_start at ./client.jl:453
jlcall__start_18748 at /Users/kmsquire/Source/julia/usr/lib/julia/sys.dylib (unknown line)
true_main at /Users/kmsquire/bin/julia (unknown line)
main at /Users/kmsquire/bin/julia (unknown line)

I assume that what ever signal is being thrown by the pipe closing (SIGPIPE?) isn't being handled properly.

This is on a fresh clone:

julia> versioninfo()
Julia Version 0.4.0-dev+5609
Commit 412918a* (2015-06-26 03:54 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin14.3.0)
  CPU: Intel(R) Core(TM)2 Extreme CPU X7900  @ 2.80GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Core2)
  LAPACK: libopenblas
  LIBM: libopenlibm
  LLVM: libLLVM-3.3
@kmsquire kmsquire added the kind:bug Indicates an unexpected problem or unintended behavior label Jun 26, 2015
@kmsquire
Copy link
Member Author

Actually, the same bug is slightly less verbose, but also happens in 0.3.9.

@kmsquire
Copy link
Member Author

(Maybe it's less verbose because the backtraces are truncated...?)

@ihnorton ihnorton added the domain:io Involving the I/O subsystem: libuv, read, write, etc. label Jun 27, 2015
Keno added a commit that referenced this issue Jun 28, 2015
When in branches that type inference knows are dead, type information
can be inaccurate and codegen basically just needs to bail out as fast
as possible.
@ihnorton
Copy link
Member

related: #9719 #9724

@JeffBezanson
Copy link
Sponsor Member

The first error is ok; you need to catch the exception caused by EPIPE if you want to silence it. The second error was the real problem.

@carnaval
Copy link
Contributor

Maybe we should get an actual roadmap for IO improvements :

  • can read stdout without spawning cat
  • can read stderr without spawning cat

JeffBezanson added a commit that referenced this issue Jun 29, 2015
don't print an extra newline to stdout when exiting with an error
when we quit on EPIPE this caused us to throw another error

(cherry picked from 34ec37d)
KristofferC pushed a commit to KristofferC/julia that referenced this issue Jun 30, 2015
don't print an extra newline to stdout when exiting with an error
when we quit on EPIPE this caused us to throw another error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:io Involving the I/O subsystem: libuv, read, write, etc. kind:bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

4 participants