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

Julia hangs when precompiling package with certain pattern #26028

Closed
KristofferC opened this issue Feb 13, 2018 · 6 comments
Closed

Julia hangs when precompiling package with certain pattern #26028

KristofferC opened this issue Feb 13, 2018 · 6 comments
Labels
compiler:precompilation Precompilation of modules regression Regression in behavior compared to a previous version

Comments

@KristofferC
Copy link
Member

KristofferC commented Feb 13, 2018

Package Foo with following structure:

Foo.jl

__precompile__()
module Foo

module Bar
    x = 0
end

function __init__()
    include(joinpath(@__DIR__, "bar.jl"))
end

end

bar.jl

import Foo.Bar.x

Trying to do using Foo now hangs indefinitely. Removing __precompile__() makes it work. Works on 0.6.2.

Stacktrace after interrupting is:

Stacktrace:
 [1] process_events at ./libuv.jl:82 [inlined]
 [2] wait() at ./event.jl:258
 [3] wait(::Condition) at ./event.jl:46
 [4] _require(::Base.PkgId) at ./loading.jl:934
 [5] require(::Module, ::Symbol) at ./loading.jl:874
 [6] include at ./boot.jl:295 [inlined]
 [7] include_relative(::Module, ::String) at ./loading.jl:1067
 [8] include at ./sysimg.jl:26 [inlined]
 [9] include at /Users/kristoffer/.julia/v0.7/Foo/src/Foo.jl:2 [inlined]
 [10] __init__() at /Users/kristoffer/.julia/v0.7/Foo/src/Foo.jl:9
 [11] _include_from_serialized(::String, ::Array{Any,1}) at ./loading.jl:656
 [12] _require_from_serialized(::String) at ./loading.jl:718
 [13] _require(::Base.PkgId) at ./loading.jl:1004
 [14] require(::Module, ::Symbol) at ./loading.jl:874
in expression starting at /Users/kristoffer/.julia/v0.7/Foo/src/bar.jl:1
@KristofferC KristofferC added compiler:precompilation Precompilation of modules regression Regression in behavior compared to a previous version labels Feb 13, 2018
@KristofferC
Copy link
Member Author

Doing import .Foo.Base.x makes it works (thanks @fredrikekre). Perhaps this made it go into an infinite loop.

@StefanKarpinski
Copy link
Member

Seems like still an issue though, right?

@KristofferC
Copy link
Member Author

KristofferC commented Feb 13, 2018

Not sure, perhaps an infinite loop is the natural result when asking to import the packages itself while it is being loaded.

@KristofferC
Copy link
Member Author

KristofferC commented Feb 13, 2018

It is odd that it depends on __precompile__() though, so reopening.

@KristofferC KristofferC reopened this Feb 13, 2018
@ViralBShah
Copy link
Member

Is this still an issue?

@KristofferC
Copy link
Member Author

There's a MWE at the top.

Keno added a commit that referenced this issue Aug 2, 2018
If a precompiled package's init function tries to itself require that
package (e.g. by importing a symbol from a submodule of that package),
we would run into a deadlock. Fix that by delaying the running of
initializers until after we've had a chance to register any root module.

Fixes #26028
Keno added a commit that referenced this issue Aug 3, 2018
If a precompiled package's init function tries to itself require that
package (e.g. by importing a symbol from a submodule of that package),
we would run into a deadlock. Fix that by delaying the running of
initializers until after we've had a chance to register any root module.

Fixes #26028
ararslan pushed a commit that referenced this issue Aug 4, 2018
If a precompiled package's init function tries to itself require that
package (e.g. by importing a symbol from a submodule of that package),
we would run into a deadlock. Fix that by delaying the running of
initializers until after we've had a chance to register any root module.

Fixes #26028

(cherry picked from commit 0e32871)
KristofferC pushed a commit that referenced this issue Feb 11, 2019
If a precompiled package's init function tries to itself require that
package (e.g. by importing a symbol from a submodule of that package),
we would run into a deadlock. Fix that by delaying the running of
initializers until after we've had a chance to register any root module.

Fixes #26028
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:precompilation Precompilation of modules regression Regression in behavior compared to a previous version
Projects
None yet
Development

No branches or pull requests

3 participants