Skip to content

Internal error: encountered unexpected error in runtime: TypeError(func=:OneTo, context="T", expected=T<:Integer, got=Float64) #42490

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

Closed
bluesmoon opened this issue Oct 4, 2021 · 3 comments
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@bluesmoon
Copy link
Contributor

bluesmoon commented Oct 4, 2021

I receive an internal error TypeError(func=:OneTo, context="T", expected=T<:Integer, got=Float64) when running some of my code. It does not appear to prevent execution of code, but does seem to slow it down a bit and prints a stack trace before code starts executing.

This may be related to #39082, but that was found in 1.7 whereas this issue is on 1.6.3.

julia> versioninfo()
Julia Version 1.6.3
Commit ae8452a9e0 (2021-09-23 17:34 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, skylake)

Stacktrace:

Internal error: encountered unexpected error in runtime:
TypeError(func=:OneTo, context="T", expected=T<:Integer, got=Float64)
jl_type_error_rt at /buildworker/worker/package_linux64/build/src/rtutils.c:119
check_datatype_parameters at /buildworker/worker/package_linux64/build/src/jltypes.c:1071
inst_datatype_inner at /buildworker/worker/package_linux64/build/src/jltypes.c:1285
inst_type_w_ at /buildworker/worker/package_linux64/build/src/jltypes.c:1693
inst_tuple_w_ at /buildworker/worker/package_linux64/build/src/jltypes.c:1602
inst_type_w_ at /buildworker/worker/package_linux64/build/src/jltypes.c:1678
jl_instantiate_unionall at /buildworker/worker/package_linux64/build/src/jltypes.c:898
jl_apply_type at /buildworker/worker/package_linux64/build/src/jltypes.c:852
subst_trivial_bounds at ./compiler/utilities.jl:157
normalize_typevars at ./compiler/utilities.jl:167
specialize_method at ./compiler/utilities.jl:179
specialize_method at ./compiler/utilities.jl:178 [inlined]
typeinf_edge at ./compiler/typeinfer.jl:769
abstract_call_method at ./compiler/abstractinterpretation.jl:490
abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:143
abstract_call_known at ./compiler/abstractinterpretation.jl:1048
abstract_call at ./compiler/abstractinterpretation.jl:1071
abstract_call at ./compiler/abstractinterpretation.jl:1055
abstract_eval_statement at ./compiler/abstractinterpretation.jl:1182
typeinf_local at ./compiler/abstractinterpretation.jl:1470
typeinf_nocycle at ./compiler/abstractinterpretation.jl:1534
_typeinf at ./compiler/typeinfer.jl:214
typeinf at ./compiler/typeinfer.jl:209
typeinf_edge at ./compiler/typeinfer.jl:806
abstract_call_method at ./compiler/abstractinterpretation.jl:490
abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:143
abstract_call_known at ./compiler/abstractinterpretation.jl:1048
abstract_call at ./compiler/abstractinterpretation.jl:1071
abstract_call at ./compiler/abstractinterpretation.jl:1055
abstract_eval_statement at ./compiler/abstractinterpretation.jl:1182
typeinf_local at ./compiler/abstractinterpretation.jl:1470
typeinf_nocycle at ./compiler/abstractinterpretation.jl:1534
_typeinf at ./compiler/typeinfer.jl:214
typeinf at ./compiler/typeinfer.jl:209
typeinf_edge at ./compiler/typeinfer.jl:806
abstract_call_method at ./compiler/abstractinterpretation.jl:490
abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:143
abstract_call_known at ./compiler/abstractinterpretation.jl:1048
abstract_call at ./compiler/abstractinterpretation.jl:1071
abstract_call at ./compiler/abstractinterpretation.jl:1055
abstract_eval_statement at ./compiler/abstractinterpretation.jl:1182
typeinf_local at ./compiler/abstractinterpretation.jl:1470
typeinf_nocycle at ./compiler/abstractinterpretation.jl:1534
_typeinf at ./compiler/typeinfer.jl:214
typeinf at ./compiler/typeinfer.jl:209
typeinf_edge at ./compiler/typeinfer.jl:806
abstract_call_method at ./compiler/abstractinterpretation.jl:490
abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:143
abstract_call_known at ./compiler/abstractinterpretation.jl:1048
abstract_call at ./compiler/abstractinterpretation.jl:1071
abstract_call at ./compiler/abstractinterpretation.jl:1055
abstract_eval_statement at ./compiler/abstractinterpretation.jl:1182
typeinf_local at ./compiler/abstractinterpretation.jl:1470
typeinf_nocycle at ./compiler/abstractinterpretation.jl:1534
_typeinf at ./compiler/typeinfer.jl:214
typeinf at ./compiler/typeinfer.jl:209
typeinf_edge at ./compiler/typeinfer.jl:806
abstract_call_method at ./compiler/abstractinterpretation.jl:490
abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:143
abstract_call_known at ./compiler/abstractinterpretation.jl:1048
abstract_call at ./compiler/abstractinterpretation.jl:1071
abstract_call at ./compiler/abstractinterpretation.jl:1055
abstract_eval_statement at ./compiler/abstractinterpretation.jl:1182
typeinf_local at ./compiler/abstractinterpretation.jl:1470
typeinf_nocycle at ./compiler/abstractinterpretation.jl:1534
_typeinf at ./compiler/typeinfer.jl:214
typeinf at ./compiler/typeinfer.jl:209
typeinf_ext at ./compiler/typeinfer.jl:892
typeinf_ext_toplevel at ./compiler/typeinfer.jl:925
typeinf_ext_toplevel at ./compiler/typeinfer.jl:921
jfptr_typeinf_ext_toplevel_10176.clone_1 at /julia-1.6.3/lib/julia/sys.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2237 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2419
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1703 [inlined]
jl_type_infer at /buildworker/worker/package_linux64/build/src/gf.c:298
jl_generate_fptr at /buildworker/worker/package_linux64/build/src/jitlayers.cpp:340
jl_compile_method_internal at /buildworker/worker/package_linux64/build/src/gf.c:1970
jl_compile_method_internal at /buildworker/worker/package_linux64/build/src/gf.c:2236 [inlined]
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2229 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2419
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1703 [inlined]
do_call at /buildworker/worker/package_linux64/build/src/interpreter.c:115
eval_value at /buildworker/worker/package_linux64/build/src/interpreter.c:204
eval_stmt_value at /buildworker/worker/package_linux64/build/src/interpreter.c:155 [inlined]
eval_body at /buildworker/worker/package_linux64/build/src/interpreter.c:562
jl_interpret_toplevel_thunk at /buildworker/worker/package_linux64/build/src/interpreter.c:670
top-level scope at /home/ubuntu/Foo/src/Foo.jl:13
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:877
jl_toplevel_eval_flex at /buildworker/worker/package_linux64/build/src/toplevel.c:825
jl_toplevel_eval_in at /buildworker/worker/package_linux64/build/src/toplevel.c:929
eval at ./boot.jl:360 [inlined]
include_string at ./loading.jl:1116
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2237 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2419
_include at ./loading.jl:1170
include at ./Base.jl:386
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2237 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2419
exec_options at ./client.jl:285
_start at ./client.jl:485
jfptr__start_43689.clone_1 at /julia-1.6.3/lib/julia/sys.so (unknown line)
_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2237 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2419
jl_apply at /buildworker/worker/package_linux64/build/src/julia.h:1703 [inlined]
true_main at /buildworker/worker/package_linux64/build/src/jlapi.c:560
repl_entrypoint at /buildworker/worker/package_linux64/build/src/jlapi.c:702
main at julia16 (unknown line)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x4007d8)

Minimal reproducible example (but also see comments for variants). This may be run from the REPL or from a file, both cases trigger the stacktrace.

"""
It is necessary for this code to be inside a module.
The error does not trigger if the function is not in a module
"""
module Foo

"""
It is necessary to use a function that operates on the AbstractRange,
simply returning `mr` does not trigger, but any function call will

It is also necessary that we use `AbstractRange{<:Float64}`. There is no
stacktrace printed if we just use `AbstractRange`, `AbstractRange{<:Real}`
or `AbstractRange{<:AbstractFloat}`
"""
foo(mr::AbstractRange{<:Float64}) = extrema(mr)

end


using .Foo
x = 123.0
y = 234.0

# At least one of these parameters MUST be a variable. The other may be a Float literal.
# You may also use an undefined variable. This will prevent the function from being called,
# but still trigger the error
testFoo() = Foo.foo(x:y)

# It is also necessary to run Foo.foo through a function call, the error does not trigger if called directly
testFoo()
@KristofferC
Copy link
Member

So to be clear, this is fixed on 1.7 and we just need to find what to backport to 1.6?

@oscardssmith oscardssmith added backport 1.6 Change should be backported to release-1.6 bug Indicates an unexpected problem or unintended behavior labels Oct 4, 2021
@vtjnash
Copy link
Member

vtjnash commented Oct 4, 2021

Added #41976 to milestone (#41908)

@vtjnash vtjnash closed this as completed Oct 4, 2021
@bluesmoon
Copy link
Contributor Author

I don't know for sure if it's the same issue, and I have not tested it on 1.7, however the report looks very similar except for the difference in types reported.

@KristofferC KristofferC removed the backport 1.6 Change should be backported to release-1.6 label Nov 19, 2021
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
Projects
None yet
Development

No branches or pull requests

4 participants