-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Show full stacktrace when Channel Task throws #35177
Conversation
This reuses the machinery that gives good stacktraces when a user calls wait on a Task. Since bind internally uses _wait2, this machinery is bypassed currently. Currently, julia throws an uninformative stacktrace in this situation: julia> c = Channel(_ -> error("foo")) Channel{Any}(sz_max:0,sz_curr:0) julia> for i in c end ERROR: foo Stacktrace: [1] iterate(::Channel{Any}) at ./channels.jl:459 [2] top-level scope at ./REPL[2]:1 With this change, the stacktrace is much more informative: julia> for i in c end ERROR: TaskFailedException: foo Stacktrace: [1] error(::String) at ./error.jl:33 [2] (::var"JuliaLang#1#2")(::Channel{Any}) at ./REPL[4]:1 [3] (::Base.var"JuliaLang#652#653"{var"JuliaLang#1#2",Channel{Any}})() at ./channels.jl:129 Stacktrace: [1] check_channel_state at ./channels.jl:167 [inlined] [2] take_unbuffered(::Channel{Any}) at ./channels.jl:405 [3] take! at ./channels.jl:383 [inlined] [4] iterate(::Channel{Any}, ::Nothing) at ./channels.jl:449 [5] iterate(::Channel{Any}) at ./channels.jl:448 [6] top-level scope at ./REPL[5]:1
Any comments on this or things I need to fix? If this isn't considered too breaking of a change, I believe this is ready to merge. |
Bumping this per fredrikekre's post on discourse in case it can make it into 1.5. I understand if it can't. |
This can still make it into 1.5. Tagging for discussion on the triage call today. |
This was a simplification missed in original JuliaLang#35177
I just noticed that I missed a braindead simplification in this PR and pushed e17696e to make this code actually make sense to people unaware of its history. |
I don't see a PR for that yet. Am I missing it or is it yet to be opened? |
I pushed it to the branch for this PR but can open a new one. Looks like CI doesn't get run if you push to a branch after it's merged, so I'll go ahead and open a new PR. EDIT: #35673 |
This was a simplification missed in original JuliaLang#35177
This was a simplification missed in original #35177
Thanks for this, @non-Jedi! :) This is great - we just noticed this was missing in 1.4 and started drafting a fix before noticing you'd already fixed it on 1.5 😊 👏 👍 |
Glad this was helpful to y'all. :) |
Not sure if this counts as a feature or a bug-fix. This was a major
pain-point for a user on gitter which seemed an easy fix once I
understood the system.
This reuses the machinery that gives good stacktraces when a user
calls
wait
on aTask
. Sincebind
internally uses_wait2
, thismachinery is bypassed currently.
Currently, julia throws an uninformative stacktrace in this situation:
With this change, the stacktrace is much more informative: