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: TypeError #32465

Closed
omalled opened this issue Jul 1, 2019 · 6 comments · Fixed by #32494
Closed

Internal error: encountered unexpected error in runtime: TypeError #32465

omalled opened this issue Jul 1, 2019 · 6 comments · Fixed by #32494
Assignees
Labels
regression Regression in behavior compared to a previous version

Comments

@omalled
Copy link

omalled commented Jul 1, 2019

I have run into an internal error with Julia 1.2.0-rc1. It can be reduced with

]dev [email protected]:madsjulia/LinearAdjoints.jl.git
]dev [email protected]:madsjulia/FiniteVolume.jl.git
]test FiniteVolume

The first handful of lines of the error message are below. An extended version of this error message seems to be repeated many times during the tests. The tests (which take about a minute on my laptop) run to completion and pass despite the error. The error does not occur with Julia 1.1.1.

Internal error: encountered unexpected error in runtime:
TypeError(func=:<:, context="", expected=Type, got=P)
rec_backtrace at /Users/julia/buildbot/worker/package_macos64/build/src/stackwalk.c:94
record_backtrace at /Users/julia/buildbot/worker/package_macos64/build/src/task.c:219
jl_throw at /Users/julia/buildbot/worker/package_macos64/build/src/task.c:429
jl_type_error_rt at /Users/julia/buildbot/worker/package_macos64/build/src/rtutils.c:118
jl_type_error at /Users/julia/buildbot/worker/package_macos64/build/src/rtutils.c:125
jl_f_issubtype at /Users/julia/buildbot/worker/package_macos64/build/src/builtins.c:411
⊑ at ./compiler/typelattice.jl:175
tmerge at ./compiler/typelimits.jl:286
getfield_tfunc at ./compiler/tfuncs.jl:763
getfield_tfunc at ./compiler/tfuncs.jl:668
jl_apply at /Users/julia/buildbot/worker/package_macos64/build/src/./julia.h:1606 [inlined]
jl_f__apply at /Users/julia/buildbot/worker/package_macos64/build/src/builtins.c:563
builtin_tfunction at ./compiler/tfuncs.jl:1365
builtin_tfunction at ./compiler/tfuncs.jl:1279 [inlined]
abstract_call at ./compiler/abstractinterpretation.jl:632
abstract_call at ./compiler/abstractinterpretation.jl:605
abstract_eval_call at ./compiler/abstractinterpretation.jl:844
abstract_eval at ./compiler/abstractinterpretation.jl:914
typeinf_local at ./compiler/abstractinterpretation.jl:1171
typeinf_nocycle at ./compiler/abstractinterpretation.jl:1227
typeinf at ./compiler/typeinfer.jl:12
typeinf_edge at ./compiler/typeinfer.jl:482
abstract_call_method at ./compiler/abstractinterpretation.jl:376
abstract_call_gf_by_type at ./compiler/abstractinterpretation.jl:93
abstract_call at ./compiler/abstractinterpretation.jl:815
abstract_call at ./compiler/abstractinterpretation.jl:605
@JeffBezanson
Copy link
Member

I'm getting Package Test not found in current path:. Not sure what's wrong.

@JeffBezanson JeffBezanson added the regression Regression in behavior compared to a previous version label Jul 2, 2019
@KristofferC
Copy link
Member

Tests passes for me on rc2 branch. I don't get the Test not found error but I did get

┌ Warning: Package LinearAdjoints does not have Test in its dependencies:
│ - If you have LinearAdjoints checked out for development and have
│   added Test as a dependency but haven't updated your primary
│   environment's manifest file, try `Pkg.resolve()`.
│ - Otherwise you may need to report an issue with LinearAdjoints
└ Loading Test into LinearAdjoints from project dependency, future warnings for LinearAdjoints are suppressed.

Not sure what why that happens, might be a loading of Test that somehow gets evaluated into LinearAdjoints.

@MoonCoral
Copy link
Contributor

After fixing the Test dependency I can reproduce the issue on master (1.3.0-DEV.473).
Some selective commenting out indicates that the problem is caused by this line https://github.com/madsjulia/FiniteVolume.jl/blob/717f526b6e856ee13266f42c74db997001720d3f/test/theisadjoint.jl#L71

I also get a very similar the same error TypeError(func=:<:, context="", expected=Type, got=T<:Real) instead of TypeError(func=:<:, context="", expected=Type, got=P). In my case it is caused by calls to a custom getproperty function. The function is to enmeshed with other code to act as MWE but the following should be of interest:

function getM0(data::Matrix)
    cholesky(Hermitian(cov(data'))).L
end

#Session is a object which loads data from disk
struct Data
    root::Session
    prior::Session
    work::Session
    values::Dict{Symbol, AbstractArray{Float64}}
end

#this triggers the issue each time data is accessed (and at the creation of data)
#even if this line is not used in that call.
function Base.getproperty(data::Data, symbol::Symbol)
    ...
    data.values[:M0] = data.work.M0 = getM0(data.data)
    ...
end

#however if the function would be written with getM0 inlined the issue does not happen.
function Base.getproperty(data::Data, symbol::Symbol)
    ...
    data.values[:M0] = data.work.M0 = cholesky(Hermitian(cov(data.data'))).L
    ...
end

There is another line which I need to comment out to prevent the issue which has the same structure just another (less trivial) function call at the end.

I tried to create a MWE based on this but I couldn't reproduce the problem with something simpler so far.

The full getproperty function can be found here: https://gist.github.com/MoonCoral/1a3795ce5e47c63508efe2d758a8017d

@JeffBezanson JeffBezanson self-assigned this Jul 2, 2019
@JeffBezanson
Copy link
Member

I still get the error about Test. Tried using a fresh .julia.

@omalled
Copy link
Author

omalled commented Jul 2, 2019

I think I "fixed" the issue with Test and now I don't get any warnings about it on 1.1.1. I can reproduce the error about Test that @JeffBezanson is seeing using commit 525d4e9 from the backports-1.2.0-rc2 branch. However, I don't get the Test error on 1.2.0-rc1 or on 1.1.1. Maybe the TypeError I originally posted about and the Test error are two separate issues? I have started with a fresh .julia directory in all the cases I have tested.

@KristofferC
Copy link
Member

I made a fork that fixes the Test issue (and a PyPlot issue). To run the test I do:

mkdir NewEnv
cd NewEnv
git clone https://github.com/KristofferC/FiniteVolume.jl
git clone https://github.com/madsjulia/LinearAdjoints.jl
julia
] activate .
] dev LinearAdjoints.jl/ FiniteVolume.jl/
] test FiniteVolume

And then after I while, I do get the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression Regression in behavior compared to a previous version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants