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

fatal: error thrown (TypeError from typeassert) & subsequent crash on yield(current_task()) #53732

Open
Seelengrab opened this issue Mar 14, 2024 · 2 comments
Labels
multithreading Base.Threads and related functionality

Comments

@Seelengrab
Copy link
Contributor

I'd have expected either a noop, or a ConcurrencyViolationError here.

Full stacktrace/MWE:

[sukera@tower ~]$ jl1101  -q
julia> versioninfo()
Julia Version 1.10.1
Commit 7790d6f0641 (2024-02-13 20:41 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 24 × AMD Ryzen 9 7900X 12-Core Processor
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, znver3)
Threads: 1 default, 0 interactive, 1 GC (on 24 virtual cores)
Environment:
  JULIA_PKG_USE_CLI_GIT = true

julia> yield(current_task())
ERROR: fatal: error thrown and no exception handler available.
TypeError(func=:typeassert, context="", expected=Int32, got=nothing)
ijl_type_error_rt at /cache/build/default-maughin-0/julialang/julia-release-1-dot-10/src/rtutils.c:119
ijl_type_error at /cache/build/default-maughin-0/julialang/julia-release-1-dot-10/src/rtutils.c:127
uv_write at ./stream.jl:1048
unsafe_write at ./stream.jl:1120
write at ./strings/io.jl:248 [inlined]
print at ./strings/io.jl:250 [inlined]
#with_output_color#994 at ./util.jl:112
with_output_color at ./util.jl:73 [inlined]
#printstyled#995 at ./util.jl:141 [inlined]
printstyled at ./util.jl:141
unknown function (ip: 0x71ad2433d070)
_jl_invoke at /cache/build/default-maughin-0/julialang/julia-release-1-dot-10/src/gf.c:2894 [inlined]
ijl_apply_generic at /cache/build/default-maughin-0/julialang/julia-release-1-dot-10/src/gf.c:3076
display_error at ./client.jl:110
unknown function (ip: 0x71ad2433cfc9)
_jl_invoke at /cache/build/default-maughin-0/julialang/julia-release-1-dot-10/src/gf.c:2894 [inlined]
ijl_apply_generic at /cache/build/default-maughin-0/julialang/julia-release-1-dot-10/src/gf.c:3076
display_error at ./client.jl:114
jfptr_display_error_82458.1 at /home/sukera/Downloads/jl/julia-1.10.1/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/default-maughin-0/julialang/julia-release-1-dot-10/src/gf.c:2894 [inlined]
ijl_apply_generic at /cache/build/default-maughin-0/julialang/julia-release-1-dot-10/src/gf.c:3076
jl_apply at /cache/build/default-maughin-0/julialang/julia-release-1-dot-10/src/julia.h:1982 [inlined]
jl_f__call_latest at /cache/build/default-maughin-0/julialang/julia-release-1-dot-10/src/builtins.c:812
#invokelatest#2 at ./essentials.jl:892 [inlined]
invokelatest at ./essentials.jl:889 [inlined]
_start at ./client.jl:554
jfptr__start_82662.1 at /home/sukera/Downloads/jl/julia-1.10.1/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/default-maughin-0/julialang/julia-release-1-dot-10/src/gf.c:2894 [inlined]
ijl_apply_generic at /cache/build/default-maughin-0/julialang/julia-release-1-dot-10/src/gf.c:3076
jl_apply at /cache/build/default-maughin-0/julialang/julia-release-1-dot-10/src/julia.h:1982 [inlined]
true_main at /cache/build/default-maughin-0/julialang/julia-release-1-dot-10/src/jlapi.c:582
jl_repl_entrypoint at /cache/build/default-maughin-0/julialang/julia-release-1-dot-10/src/jlapi.c:731
main at /cache/build/default-maughin-0/julialang/julia-release-1-dot-10/cli/loader_exe.c:58
unknown function (ip: 0x71ad2551bccf)
__libc_start_main at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: 0x4010b8)
@Seelengrab Seelengrab added the multithreading Base.Threads and related functionality label Mar 14, 2024
@vtjnash
Copy link
Sponsor Member

vtjnash commented Mar 14, 2024

We should perhaps make the warning against this more scary looking? Throwing a ConcurrencyViolationError in some of the easier cases (such as this) may be possible too.

!!! warning
    It is incorrect to use `schedule` on an arbitrary `Task` that has already been started.
    See [the API reference](@ref low-level-schedule-wait) for more information.

@Seelengrab
Copy link
Contributor Author

I was mostly just curious what happened, since wait catches this trivial failure case, so my thinking was that yield should too. I'll see if I get to a PR later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
multithreading Base.Threads and related functionality
Projects
None yet
Development

No branches or pull requests

2 participants