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

fix a bug in code that restores the prompt on ^C #10416

Closed
wants to merge 1 commit into from

Conversation

JeffBezanson
Copy link
Member

While fixing #10405 I noticed a bug in the mechanism that gives control back to the REPL on ^C:

julia> T = @schedule sleep(100000)
Task (waiting) @0x00007fa4c77f51e0

julia> S = @schedule wait(T)
Task (waiting) @0x00007fa4c77f5600

julia> schedule(T, InterruptException(),error=true)
ERROR (unhandled task failure): InterruptException:
 in wait at ./task.jl:304
 in wait at ./task.jl:220
 in wait_full at ./multi.jl:567
 in take! at ./multi.jl:739
 in take_ref at ./multi.jl:746
 in call_on_owner at ./multi.jl:712
 in anonymous at task.jl:82
Task (failed) @0x00007fa4c77f51e0

julia> 1+2

and the REPL is dead and never comes back. The problem is that when task S dies (as expected), it sees the REPL is "waiting" and so throws the error to it. But the REPL is actually waiting for the backend channel (I think) and not for something that should be interrupted.

My fix is to only throw the error to the REPL if the REPL is in the middle of evaluating something. This patch works but is clearly pretty hacky. Would like to figure out the right way to do this. cc @Keno

@StefanKarpinski
Copy link
Member

Printing errors is already paying dividends :-)

I think it may be worth considering making the entire process return with an erroneous status code if any task ended with an error without some kind of cleanup.

Keno added a commit that referenced this pull request Mar 19, 2015
A slightly more organized way to do #10416, making sure that the prompt
gets restored on an InterruptException, even if it is not currently evaluating
anything.
Keno added a commit that referenced this pull request Mar 19, 2015
A slightly more organized way to do #10416, making sure that the prompt
gets restored on an InterruptException, even if it is not currently evaluating
anything.
Keno added a commit that referenced this pull request Mar 19, 2015
A slightly more organized way to do #10416, making sure that the prompt
gets restored on an InterruptException, even if it is not currently evaluating
anything.
@JeffBezanson JeffBezanson deleted the jb/replinterruptfix branch March 19, 2015 15:22
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 this pull request may close these issues.

2 participants