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

Internal error: encountered unexpected error in runtime: MethodError(... #34513

Closed
ablaom opened this issue Jan 26, 2020 · 4 comments
Closed

Comments

@ablaom
Copy link

ablaom commented Jan 26, 2020

I'm encountering this only in julia 1.0.5 and julia 1.1.1. No problems for 1.2, 1,3 and nightly.

See this travis test of my unregistered package MLJTuning, with all testing turning off except testing of src/julia_bug.jl where I've tried to isolate the issue as best as I can.

Internal error: encountered unexpected error in runtime:
325MethodError(f=typeof(Core.Compiler.fieldindex)(), args=(MLJTuning.DeterministicTunedModel{T, M, R} where R, :acceleration, false), world=0x0000000000000eb9)
326rec_backtrace at /buildworker/worker/package_linux64/build/src/stackwalk.c:94
327record_backtrace at /buildworker/worker/package_linux64/build/src/task.c:217 [inlined]
328jl_throw at /buildworker/worker/package_linux64/build/src/task.c:417
329jl_method_error_bare at /buildworker/worker/package_linux64/build/src/gf.c:1627
330jl_method_error at /buildworker/worker/package_linux64/build/src/gf.c:1645
331jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2173
332_fieldtype_nothrow at ./compiler/tfuncs.jl:803
333_fieldtype_nothrow at ./compiler/tfuncs.jl:799
334jfptr__fieldtype_nothrow_2515.clone_1 at /home/travis/julia/lib/julia/sys.so (unknown line)
335jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2197
336fieldtype_nothrow at ./compiler/tfuncs.jl:794
337_builtin_nothrow at ./compiler/tfuncs.jl:1168
338stmt_effect_free at ./compiler/ssair/queries.jl:34
339optimize at ./compiler/optimize.jl:178
340typeinf at ./compiler/typeinfer.jl:35
341abstract_call_method_with_const_args at ./compiler/abstractinterpretation.jl:198
342abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:107
343abstract_call at ./compiler/abstractinterpretation.jl:776
344abstract_eval_call at ./compiler/abstractinterpretation.jl:805
345abstract_eval at ./compiler/abstractinterpretation.jl:890
346typeinf_local at ./compiler/abstractinterpretation.jl:1135
347typeinf_nocycle at ./compiler/abstractinterpretation.jl:1191
348typeinf at ./compiler/typeinfer.jl:14
349typeinf_edge at ./compiler/typeinfer.jl:497
350abstract_call_method at ./compiler/abstractinterpretation.jl:345
351abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:85
352abstract_call at ./compiler/abstractinterpretation.jl:776
353abstract_eval_call at ./compiler/abstractinterpretation.jl:805
. . .
. . .
. . .
1193   [96] (::getfield(MLJTuning, Symbol("#kw##learning_curve!")))(::Any, ::typeof(learning_curve!), ::Machine{#s34} where #s34<:Supervised) at ./none:0
1194   [97] top-level scope at none:0
1195   [98] include at ./boot.jl:326 [inlined]
1196   [99] include_relative(::Module, ::String) at ./loading.jl:1038
1197   [100] include(::Module, ::String) at ./sysimg.jl:29
1198   [101] include(::String) at ./client.jl:403
1199   [102] top-level scope at /home/travis/build/alan-turing-institute/MLJTuning.jl/test/runtests.jl:36
1200   [103] top-level scope at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Test/src/Test.jl:1083
1201  in expression starting at /home/travis/build/alan-turing-institute/MLJTuning.jl/test/julia_bug.jl:22
1202Test Summary: | Error  Total
1203julia bug     |     1      1
1204ERROR: LoadError: Some tests did not pass: 0 passed, 0 failed, 1 errored, 0 broken.
1205in expression starting at /home/travis/build/alan-turing-institute/MLJTuning.jl/test/runtests.jl:35
1206ERROR: Package MLJTuning errored during testing
1207Stacktrace:
1208 [1] pkgerror(::String, ::Vararg{String,N} where N) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Types.jl:120
1209 [2] #test#66(::Bool, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/Operations.jl:1329
1210 [3] #test at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:0 [inlined]
1211 [4] #test#46(::Bool, ::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}, ::Function, ::Pkg.Types.Context, ::Array{Pkg.Types.PackageSpec,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:198
1212 [5] #test at ./none:0 [inlined]
1213 [6] #test#45 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:180 [inlined]
1214 [7] #test at ./none:0 [inlined]
1215 [8] #test#42 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.1/Pkg/src/API.jl:177 [inlined]
1216 [9] (::getfield(Pkg.API, Symbol("#kw##test")))(::NamedTuple{(:coverage,),Tuple{Bool}}, ::typeof(Pkg.API.test)) at ./none:0
1217 [10] top-level scope at none:1
1218The command "julia --check-bounds=yes --color=yes -e "if VERSION < v\"0.7.0-DEV.5183\"; Pkg.test(\"${JL_PKG}\", coverage=true); else using Pkg; Pkg.test(coverage=true); end"" failed and exited with 1 during .
1219
1220Your build has been stopped.
@ablaom
Copy link
Author

ablaom commented Jan 27, 2020

Okay, it seems that the compiler is having problem with a struct field with an abstract type annotation. If I change:

mutable struct DeterministicTunedModel{T,M<:Deterministic,R} <: MLJBase.Deterministic
    model::M
    tuning::T  # tuning strategy
    resampling # resampling strategy
    measure
    weights::Union{Nothing,Vector{<:Real}}
    operation
    range::R
    train_best::Bool
    repeats::Int
    n::Union{Int,Nothing}
    acceleration::AbstractResource               # <--------------
    acceleration_resampling::AbstractResource   # <---------------
    check_measure::Bool
end

to

#     add type parameters `A` and `AR`:
mutable struct DeterministicTunedModel{T,M<:Deterministic,R,A,AR} <: MLJBase.Deterministic
    model::M
    tuning::T  # tuning strategy
    resampling # resampling strategy
    measure
    weights::Union{Nothing,Vector{<:Real}}
    operation
    range::R
    train_best::Bool
    repeats::Int
    n::Union{Int,Noting}
    acceleration::A              #  <------------
    acceleration_resampling::AR   # <------------
    check_measure::Bool
end

(and do this for another similar struct) then the error goes away.

@JeffBezanson
Copy link
Sponsor Member

Closing since this is fixed in newer versions.

@ablaom
Copy link
Author

ablaom commented Feb 19, 2020

Are you no longer supporting 1.0.? My issues was with 1.0.5 and there is no later patch I can see.

@JeffBezanson
Copy link
Sponsor Member

I believe the fix is #31670, which is on the backport list for 1.0.6, but it will take a bit of work.

vtjnash added a commit that referenced this issue Aug 31, 2021
We're currently careful never to make these. But good to be careful?

refs #34513
vtjnash added a commit that referenced this issue Aug 31, 2021
We're currently careful never to make these. But good to be careful?

refs #34513
aviatesk pushed a commit that referenced this issue Aug 31, 2021
…#34541)

We're currently careful never to make these. But good to be careful?

refs #34513
LilithHafner pushed a commit to LilithHafner/julia that referenced this issue Feb 22, 2022
…JuliaLang#34541)

We're currently careful never to make these. But good to be careful?

refs JuliaLang#34513
LilithHafner pushed a commit to LilithHafner/julia that referenced this issue Mar 8, 2022
…JuliaLang#34541)

We're currently careful never to make these. But good to be careful?

refs JuliaLang#34513
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

No branches or pull requests

2 participants