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

Weird and bad things happen if @surpress is used in a @async #28

Open
oxinabox opened this issue Sep 15, 2018 · 2 comments
Open

Weird and bad things happen if @surpress is used in a @async #28

oxinabox opened this issue Sep 15, 2018 · 2 comments

Comments

@oxinabox
Copy link

MVE

In julia 0.7

julia> using Suppressor

julia> function foo()
       @sync for ii in 1:10
       @async begin
           @suppress print(ii)
       end
       end
       println("FIRE")

       end
foo (generic function with 1 method)

julia> foo()
ERROR: SystemError: dup: Bad file descriptor
#systemerror#39(::Nothing, ::Function, ::String, ::Bool) at ./error.jl:106
dup at ./error.jl:106 [inlined]
_redirect_stdout(::Base.PipeEndpoint) at ./stream.jl:923
redirect_stdout(::Base.PipeEndpoint) at ./stream.jl:928
macro expansion at /home/wheel/oxinabox/.julia/packages/Suppressor/qdsy/src/Suppressor.jl:30 [inlined]
macro expansion at ./REPL[2]:4 [inlined]
(::getfield(Main, Symbol("##3#6")))() at ./task.jl:262

...and 4 more exception(s).

Stacktrace:
 [1] sync_end(::Array{Any,1}) at ./task.jl:229
 [2] macro expansion at ./REPL[2]:3 [inlined]
 [3] macro expansion at ./task.jl:247 [inlined]
 [4] foo() at ./REPL[2]:2
 [5] top-level scope at none:0

julia> println("Hi")

julia>

So throws an error and breaks the ability to create output.

I first encountered this in a situation where I was capturing all exceptions,
and reprinting them as warnings.
Which, because this error breaks the ability to produce output via normal means,
no warnings were being displayed.
So I was confused to see my code generating an output that looked like a failure case,
but that had no warnings being displayed.
And man my debugging via @show was confusing.

@bramtayl
Copy link

Any idea what was causing this? I can get the same error running redirect_stderr in doctests.

@glwagner
Copy link

I've also run into this error trying to use @suppress embedded in asyncmap or @async.

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

No branches or pull requests

3 participants