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

World age issue when precompiling and redirecting the logger stream #28042

Closed
fredrikekre opened this issue Jul 10, 2018 · 8 comments
Closed
Labels
compiler:precompilation Precompilation of modules logging The logging framework

Comments

@fredrikekre
Copy link
Member

fredrikekre commented Jul 10, 2018

See JuliaLang/IJulia.jl#677. IJulia sets the global logger with its own stream which causes the following during precompilation of a package:

MethodError: no method matching pipe_writer(::IJulia.IJuliaStdio{Base.PipeEndpoint})
The applicable method may be too new: running in world age 27495, while current world is 27509.
Closest candidates are:
  pipe_writer(::IJulia.IJuliaStdio) at /home/fredrik/.julia/dev/IJulia/src/stdio.jl:15 (method too new to be called from this world context.)
  pipe_writer(!Matched::Base.ProcessChain) at process.jl:344
  pipe_writer(!Matched::Base.Process) at process.jl:332

Here is another repro from @pfitzseb:

julia> using Logging
       struct MyLogger <: AbstractLogger end
       Logging.shouldlog(::MyLogger, level, _module, group, id) = false
       Logging.min_enabled_level(::MyLogger) = Logging.BelowMinLevel

shell> rm -rf /home/fredrik/.julia/compiled/v0.7/BenchmarkTools/

julia> with_logger(MyLogger()) do
           @eval using BenchmarkTools
       end
ERROR: MethodError: no method matching shouldlog(::MyLogger, ::LogLevel, ::Module, ::Symbol, ::Symbol)
The applicable method may be too new: running in world age 27495, while current world is 27499.
Closest candidates are:
  shouldlog(::MyLogger, ::Any, ::Any, ::Any, ::Any) at REPL[0]:3 (method too new to be called from this world context.)
  shouldlog(::NullLogger, ::Any...) at logging.jl:83
  shouldlog(::SimpleLogger, ::Any, ::Any, ::Any, ::Any) at logging.jl:507
  ...
Stacktrace:
 [1] macro expansion at ./logging.jl:306 [inlined]
 [2] compilecache(::Base.PkgId) at ./loading.jl:1169
 [3] _require(::Base.PkgId) at ./loading.jl:942
 [4] require(::Base.PkgId) at ./loading.jl:838
 [5] require(::Module, ::Symbol) at ./loading.jl:833
 [6] eval at ./boot.jl:319 [inlined]
 [7] (::getfield(Main, Symbol("##3#4")))() at ./REPL[2]:2
 [8] with_logstate(::getfield(Main, Symbol("##3#4")), ::Base.CoreLogging.LogState) at ./logging.jl:385
 [9] with_logger(::Function, ::MyLogger) at ./logging.jl:481
 [10] top-level scope at none:0
@pfitzseb
Copy link
Member

This is a relatively recent regression; I can't repro this on

Julia Version 0.7.0-beta.113
Commit 324e525786 (2018-07-02 03:28 UTC)

@fredrikekre
Copy link
Member Author

Perhaps related to some of @StefanKarpinski's recent code-loading changes?

@StefanKarpinski
Copy link
Member

None of my changes should affect anything world-age-related. Maybe #27549?

@pfitzseb
Copy link
Member

pfitzseb commented Jul 10, 2018

Regression seems to have occurred sometime between

Julia Version 0.7.0-beta.113
Commit 324e525786 (2018-07-02 03:28 UTC)

and

Julia Version 0.7.0-beta.138
Commit 429e2d5070 (2018-07-04 14:10 UTC)

but that's all the bisecting I'm gonna do today.

Edit: 027e344 seems kinda relevant judging by the commit message.

@StefanKarpinski
Copy link
Member

Ah yes, #27894 is actually what I meant to find above.

@fredrikekre
Copy link
Member Author

fredrikekre commented Jul 10, 2018

Indeed, git bisect points to 027e344 @JeffBezanson

A trivial fix would be to change

@logmsg verbosity "Recompiling stale cache file $cachefile for module $name"
and
@logmsg verbosity "Precompiling module $name"
to good old printlns

@vtjnash
Copy link
Member

vtjnash commented Jul 11, 2018

Ah, yes. We might need to revert that commit, or at least make it only applicable inside the precompile process children

@fredrikekre fredrikekre added the compiler:precompilation Precompilation of modules label Jul 11, 2018
@pfitzseb pfitzseb mentioned this issue Jul 14, 2018
6 tasks
@pfitzseb
Copy link
Member

Should that commit be reverted or is there a solution that keeps the performance improvements and doesn't break things, @JeffBezanson?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:precompilation Precompilation of modules logging The logging framework
Projects
None yet
Development

No branches or pull requests

4 participants