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

jl_uv_writecb() ERROR: broken pipe EPIPE on windows() #14

Closed
musm opened this issue Aug 25, 2016 · 19 comments · Fixed by #15
Closed

jl_uv_writecb() ERROR: broken pipe EPIPE on windows() #14

musm opened this issue Aug 25, 2016 · 19 comments · Fixed by #15

Comments

@musm
Copy link
Contributor

musm commented Aug 25, 2016

No description provided.

@KristofferC
Copy link
Owner

@musm
Copy link
Contributor Author

musm commented Aug 25, 2016

using PimpMyRepl

gives the error

rc3 julia windows 64bit

@KristofferC
Copy link
Owner

Standard windows console?

@KristofferC
Copy link
Owner

cmd.exe that is?

@musm
Copy link
Contributor Author

musm commented Aug 25, 2016

So I get the error using conemu and calling julia through the powershell.
Using cmd through conemu and calling julia then I don't get the error

@musm
Copy link
Contributor Author

musm commented Aug 25, 2016

In any case for both versions pasting is extremely slow

@KristofferC
Copy link
Owner

KristofferC commented Aug 25, 2016

Yes, it is a problem with some windows terminals that they don't support bracket paste and that their write calls are slow. Base Julia also has the problem, but to a lesser extent after I did JuliaLang/julia#17868. However, the same trick can't be used here because we might have to update the whole line even after a single keypress due to the syntax highlighting. Use proper terminals like Mintty and it will be instant :)

@KristofferC
Copy link
Owner

Since it works on cmd and I am not doing anything weird with the pipe writing I don't think the issue is here. If you have the desire you could step through with Gallium.jl and see exactly where the error happens.

@Ismael-VC
Copy link

I can confirm this behavior on Windows 10 64 bits:

               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.0-dev.62 (2016-08-07 02:31 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit d3df8e7 (18 days old master)
|__/                   |  x86_64-w64-mingw32

julia> jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE

jl_uv_writecb() ERROR: broken pipe EPIPE
jl_uv_writecb() ERROR: broken pipe EPIPE    # ENTER

julia>

Cmder:

image

Cmd:

image

Mingw:

image

@KristofferC KristofferC reopened this Aug 26, 2016
@KristofferC
Copy link
Owner

Interesting. I will check stuff on my windows machine tonight. If you want to help could you check if removing all the redirect_stderr stuff around the include("ErrorMessages.jl") helps.

@Ismael-VC
Copy link

Indeed that seems to be related, if I comment those lines:

if VERSION > v"0.5-"
    prev_stdout = STDERR
    # redirect_stderr()
    include("ErrorMessages.jl")
    # redirect_stderr(prev_stdout)
end

I get the

               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.6.0-dev.62 (2016-08-07 02:31 UTC)
 _/ |\__'_|_|_|\__'_|  |  Commit d3df8e7 (19 days old master)
|__/                   |  x86_64-w64-mingw32

julia> WARNING: Method definition display_error(IO, Any, Any) in module REPL at REPL.jl:112 overwritten in module ErrorMessages at C:\Users\Ismael\.julia\v0.6\PimpMyREPL\src\ErrorMessages.jl:29.
WARNING: Method definition showerror(IO, Any, Any) in module Base at replutil.jl:199 overwritten in module ErrorMessages at C:\Users\Ismael\.julia\v0.6\PimpMyREPL\src\ErrorMessages.jl:45.
WARNING: Method definition #showerror(Array{Any, 1}, Base.#showerror, IO, Any, Any) in module Base overwritten in module ErrorMessages.
WARNING: Method definition show_backtrace(IO, Array{T<:Any, 1}) in module Base at replutil.jl:571 overwritten in module ErrorMessages at C:\Users\Ismael\.julia\v0.6\PimpMyREPL\src\ErrorMessages.jl:80.
WARNING: Method definition process_backtrace(Function, Array{T<:Any, 1}) in module Base at replutil.jl:584 overwritten in module ErrorMessages at C:\Users\Ismael\.julia\v0.6\PimpMyREPL\src\ErrorMessages.jl:98.
WARNING: Method definition process_backtrace(Function, Array{T<:Any, 1}, Int64) in module Base at replutil.jl:584 overwritten in module ErrorMessages at C:\Users\Ismael\.julia\v0.6\PimpMyREPL\src\ErrorMessages.jl:98.
WARNING: Method definition #process_backtrace(Array{Any, 1}, Base.#process_backtrace, Function, Array{T<:Any, 1}) in module Base overwritten in module ErrorMessages.
WARNING: Method definition #process_backtrace(Array{Any, 1}, Base.#process_backtrace, Function, Array{T<:Any, 1}, Int64) in module Base overwritten in module ErrorMessages.
WARNING: Method definition show_lambda_types(IO, LambdaInfo) in module Base at show.jl:1013 overwritten in module ErrorMessages at C:\Users\Ismael\.julia\v0.6\PimpMyREPL\src\ErrorMessages.jl:130.
WARNING: Method definition show_trace_entry(Any, Any, Any) in module Base at replutil.jl:565 overwritten in module ErrorMessages at C:\Users\Ismael\.julia\v0.6\PimpMyREPL\src\ErrorMessages.jl:168.
WARNING: Method definition show(IO, Base.StackTraces.StackFrame) in module StackTraces at stacktraces.jl:204 overwritten in module ErrorMessages at C:\Users\Ismael\.julia\v0.6\PimpMyREPL\src\ErrorMessages.jl:177.
WARNING: Method definition #show(Array{Any, 1}, Base.#show, IO, Base.StackTraces.StackFrame) in module StackTraces overwritten in module ErrorMessages.
WARNING: Method definition with_output_color(Function, Symbol, IO, Any...) in module Base at util.jl:297 overwritten in module ErrorMessages at C:\Users\Ismael\.julia\v0.6\PimpMyREPL\src\ErrorMessages.jl:200.

But not the error from this issue. On a simillar issue, I have tried to do this macro, but I it has never worked as expected, and I remember seing once this error of broken pipe if I remember correctly:

macro supress_err(block)
    quote
        orig = STDERR
        redirect_stderr()
        val = $block
        redirect_stderr(orig)
        val
    end
end

@Ismael-VC
Copy link

In WSL (Windows subsystem for Linux) I don't have real native linux here:

julia> macro errnull(block)
           quote
               orig = STDERR
               redirect_stderr()
               val = $block
               redirect_stderr(orig)
               val
           end
       end
@errnull (macro with 1 method)

julia> @errnull warn()
[1]    17 abort (core dumped)  julia
julia  7.69s user 2.36s system 106% cpu 9.441 total

In windows:

julia> macro errnull(block)
                  quote
                      orig = STDERR
                      redirect_stderr()
                      val = $block
                      redirect_stderr(orig)
                      val
                  end
              end

julia> @errnull warn()

julia> @errnull error()
ERROR:
 in error at error.jl:22

@KristofferC
Copy link
Owner

Seema redirect_stderr is not working so good then... not sure what to do. Kinda annoying to always see those error messages.

@Ismael-VC
Copy link

I will ask in stack overflow, maybe even Jeff gets to answer it, if that fails I'll raise an issue.

@Ismael-VC
Copy link

@Ismael-VC
Copy link

Ismael-VC commented Aug 27, 2016

@KristofferC @suppress_err fixes PimpMyREPL issue, I can make a PR, do you want to copy the macro or use using Suppressor? I made the package just in case this fixed both JuliaParser REPl and PimpMyREPL, but it seems that while this fixes the pimped REPL it does not fix JuliaParser's REPL

using Suppressor

if VERSION > v"0.5-" && !haskey(ENV, "LEGACY_ERRORS")
    @suppress_err include("ErrorMessages.jl")
end

The trick was to keep alive the return value of redirect_stderr(ORIGINAL_STDERR), if not it get garbage collected:

macro suppress_err(block)
    quote
        if ccall(:jl_generating_output, Cint, ()) == 0
            ORIGINAL_STDERR = STDERR
            err_rd, err_wr = redirect_stderr()

            value = $(esc(block))

            REDIRECTED_STDERR = STDERR
            # need to keep the return value live
            err_stream = redirect_stderr(ORIGINAL_STDERR)

            return value
        end
    end
end

@KristofferC
Copy link
Owner

Should be fixed now. Thanks for the report @musm and sorry for closing the issue when it actually was a problem with the package. Also thanks @Ismael-VC for looking into the problem more carefully.

@musm
Copy link
Contributor Author

musm commented Aug 29, 2016

Thanks. How do I use mintty with julia? It looks like I have to install the whole cygwin or mysys just to use Julia with mintty?

@KristofferC
Copy link
Owner

I believe so, yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants