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

Log precompile _failures_ as well as errors. Pass log level through to helper process. #457

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

NHDaly
Copy link
Member

@NHDaly NHDaly commented Oct 16, 2020

This allows users to set the debug log level in the process, not just
via the JULIA_DEBUG=all environment variable (we thought we had
enabled the debug messages, but we had not! 😬 ).

Also, adds a log statement for precompile statements that fail, not
just those that error. For example, this surfaces this failure:

┌ Debug: Precompilation failed: precompile(Tuple{typeof(Base.deepcopy_internal), Any, Base.IdDict{Any, Any}})
└ @ Main.anonymous none:31

Which is a pattern I've noticed in our own precompilation failures,
where Julia seems to be emitting a precompile statement with an abstract
argument (Any in this case, but i've seen others) for a method that is
not marked @nospecialize, which causes precompile() to fail, since
you cannot normally instantiate a method for abstract types.

So that's a separate issue that we need to dig into, but this PR allows
us to identify issues like these. :)

…o helper process.

This allows users to set the debug log level in the process, not just
via the `JULIA_DEBUG=all` environment variable (we _thought_ we had
enabled the debug messages, but we had not! 😬 ).

Also, adds a log statement for precompile statements that _fail_, not
just those that error. For example, this surfaces this failure:

```julia
┌ Debug: Precompilation failed: precompile(Tuple{typeof(Base.deepcopy_internal), Any, Base.IdDict{Any, Any}})
└ @ Main.anonymous none:31
```

Which is a pattern I've noticed in our own precompilation failures,
where Julia seems to be emitting a precompile statement with an abstract
argument (`Any` in this case, but i've seen others) for a method that is
_not_ marked `@nospecialize`, which causes `precompile()` to fail, since
you cannot normally instantiate a method for abstract types.

So that's a separate issue that we need to dig into, but this PR allows
us to identify issues like these. :)
@NHDaly NHDaly force-pushed the nhd-Log-precompile-failures branch from 76c29e0 to 6aa2fb2 Compare October 16, 2020 21:31
@NHDaly
Copy link
Member Author

NHDaly commented Oct 16, 2020

I would prefer to be able to somehow pass through the Log config if you set JULIA_DEBUG=PackageCompiler, but i couldn't figure out how to get that to work on the spawned process, because of the anonymous modules it creates.

I'd love suggestions for that if you have any! :)

@codecov-io
Copy link

codecov-io commented Oct 16, 2020

Codecov Report

Merging #457 into master will decrease coverage by 0.59%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #457      +/-   ##
==========================================
- Coverage   84.91%   84.31%   -0.60%     
==========================================
  Files           2        2              
  Lines         338      338              
==========================================
- Hits          287      285       -2     
- Misses         51       53       +2     
Impacted Files Coverage Δ
src/PackageCompiler.jl 84.03% <100.00%> (-0.61%) ⬇️
src/juliaconfig.jl 87.09% <0.00%> (-0.41%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8d31d60...2e50a35. Read the comment docs.

end
total = length(precompile_statements)
@info "PackageCompiler: completed \$total precompile statements with \$failures failures, \$errors errors."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One problem here is that people think there is something wrong with their code when they see "x errors" but there is really nothing they can do to fix it. So I'm a little bit against adding this as something people see by default.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, i had the same concern, and wasn't sure what to do about it.

Maybe a flag, to control reporting precompilation success rate?

Or we could print this to @debug, too, but debug is very noisy and i think we'd like to see this all the time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have any suggestions? :) Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can also print the link to the julia issue that's in the comment, above?

Or do you think I should just move this to a @debug log as well?

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

Successfully merging this pull request may close these issues.

3 participants