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

Dependency cycles lead to repeated attempted pre-compilation and error spew #55937

Open
topolarity opened this issue Sep 30, 2024 · 1 comment
Labels
compiler:precompilation Precompilation of modules

Comments

@topolarity
Copy link
Member

Make two packages Foo and Bar that depend on each other:

$ cat Foo/src/Foo.jl
module Foo
using Bar
println("Executing Foo!\n")
end # module Foo
$ cat Bar/src/Bar.jl
module Bar
using Foo
println("Executing Bar!\n")
end # module Bar

pkg> precompile works fine (albeit the warning isn't terribly clear whether this is an issue or not):

┌ Warning: Circular dependency detected. Precompilation will be skipped for:
│   Base.PkgId(Base.UUID("9b094d01-e697-4a76-8fe8-871656a862e0"), "Foo")
│   Base.PkgId(Base.UUID("ed96e9dd-c367-45ab-9d59-befe4c57f37f"), "Bar")
└ @ Base.Precompilation precompilation.jl:562

However actually using either package leads to nested re-precompilation and very verbose error messages:

julia> using Foo
┌ Warning: Circular dependency detected. Precompilation will be skipped for:
│   Base.PkgId(Base.UUID("9b094d01-e697-4a76-8fe8-871656a862e0"), "Foo")
│   Base.PkgId(Base.UUID("ed96e9dd-c367-45ab-9d59-befe4c57f37f"), "Bar")
└ @ Base.Precompilation precompilation.jl:562
[ Info: Precompiling Foo [9b094d01-e697-4a76-8fe8-871656a862e0] (cache misses: include_dependency fsize change (4))
┌ Warning: Module Foo with build ID ffffffff-ffff-ffff-0001-e5501f34bcab is missing from the cache.
│ This may mean Foo [9b094d01-e697-4a76-8fe8-871656a862e0] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2497
┌ Info: Skipping precompilation due to precompilable error. Importing Foo [9b094d01-e697-4a76-8fe8-871656a862e0].
└   exception = Error when precompiling module, potentially caused by a __precompile__(false) declaration in the module.
┌ Warning: Circular dependency detected. Precompilation will be skipped for:
│   Base.PkgId(Base.UUID("9b094d01-e697-4a76-8fe8-871656a862e0"), "Foo")
│   Base.PkgId(Base.UUID("ed96e9dd-c367-45ab-9d59-befe4c57f37f"), "Bar")
└ @ Base.Precompilation precompilation.jl:562
[ Info: Precompiling Bar [ed96e9dd-c367-45ab-9d59-befe4c57f37f] (cache misses: include_dependency fsize change (4))
┌ Warning: Module Foo with build ID ffffffff-ffff-ffff-0001-e550421fe669 is missing from the cache.
│ This may mean Foo [9b094d01-e697-4a76-8fe8-871656a862e0] does not support precompilation but is imported by a module that does.
└ @ Base loading.jl:2497
┌ Info: Skipping precompilation due to precompilable error. Importing Bar [ed96e9dd-c367-45ab-9d59-befe4c57f37f].
└   exception = Error when precompiling module, potentially caused by a __precompile__(false) declaration in the module.
Executing Bar!

Executing Foo!

Even worse, this warning spew happens every single time you using either package in a new session.

I believe this is the reason that #55557 took 25 minutes, so it can be a very bad experience depending on where you hit the cycle.

@topolarity
Copy link
Member Author

topolarity commented Sep 30, 2024

Perhaps pre-compilation needs to create a "cache" file describing its results even when those results are negative (i.e. package errored, or was in a cycle)

@topolarity topolarity added the compiler:precompilation Precompilation of modules label Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:precompilation Precompilation of modules
Projects
None yet
Development

No branches or pull requests

1 participant