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

task_done_hook has no InterruptException handler #19467

Closed
quinnj opened this issue Dec 1, 2016 · 11 comments
Closed

task_done_hook has no InterruptException handler #19467

quinnj opened this issue Dec 1, 2016 · 11 comments
Labels
bug Indicates an unexpected problem or unintended behavior error handling Handling of exceptions by Julia or the user

Comments

@quinnj
Copy link
Member

quinnj commented Dec 1, 2016

Case 1:

function try_no_segfault()
    while true
        try
            sleep(1)
            println("trying...")
            # @async 1+1
        catch e
            if typeof(e) <: InterruptException
                println("caught Interrupt")
                return
            end
        end
    end
    return
end

Case 2:

function try_segfault()
    while true
        try
            sleep(1)
            println("trying...")
            @async 1+1
        catch e
            if typeof(e) <: InterruptException
                println("caught Interrupt")
                return
            end
        end
    end
    return
end

In the successful case, run try_no_segfault(), then CTRL+c to see a successful interrupt and return to the julia prompt.

To reproduce the segfault, run try_segfault(), then CTRL+c to see a segfault and end of the julia session.

@yuyichao
Copy link
Contributor

yuyichao commented Dec 1, 2016

Which version are you using? And is it actually a segfault?

@quinnj
Copy link
Member Author

quinnj commented Dec 1, 2016

julia> versioninfo()
Julia Version 0.5.0
Commit 3c9d753 (2016-09-19 18:14 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin13.4.0)
  CPU: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, haswell)

No, I'm not sure it's a segfault, but it does end my julia session instead of just exiting the function, and it seems to be purely because of the presence of the @async block.

@amitmurthy
Copy link
Contributor

This may help in identifying the problem. Adding a yield() before the sleep() makes the problem go away.

        try
            yield()
            sleep(1)
            println("trying...")
            @async 1+1             
        catch e

Issue exists on 0.4 too.

@yuyichao
Copy link
Contributor

yuyichao commented Dec 1, 2016

The yield simply makes the window this can happen much smaller.

@amitmurthy
Copy link
Contributor

There may be something more. I couldn't crash it with the yield() before the sleep() even after many tries. A yield() after the sleep() has no effect....

@yuyichao
Copy link
Contributor

yuyichao commented Dec 1, 2016

Well, it shortens the window from 1 second to few micro second so you'll have a pretty hard time triggering it.

@kshyatt kshyatt added the error handling Handling of exceptions by Julia or the user label Dec 1, 2016
@quinnj
Copy link
Member Author

quinnj commented Dec 23, 2016

@yuyichao, any ideas on how to fix this?

@StefanKarpinski StefanKarpinski added the bug Indicates an unexpected problem or unintended behavior label Jan 3, 2017
@StefanKarpinski StefanKarpinski added this to the 1.0 milestone Jan 3, 2017
@vtjnash vtjnash changed the title InterruptException segfault task_done_hook has no InterruptException handler Apr 22, 2017
@vtjnash
Copy link
Member

vtjnash commented Apr 22, 2017

This would be fixed by #14032

@StefanKarpinski
Copy link
Member

Does changing the behavior of ctrl-C count as breaking production code?

@StefanKarpinski
Copy link
Member

This doesn't seem like it needs to be in the 1.0 milestone. Speak up otherwise.

@arnaudh
Copy link

arnaudh commented Jan 10, 2023

The Ctrl-C issue in the description is happening again, at least on Julia 1.9.0 and 1.8.3 (see #45055, not sure if we should close that one and reopen the current issue? Would probably need an updated title).

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

No branches or pull requests

7 participants