timholy / SnoopCompile.jl

Provide insights about latency (TTFX) for Julia packages
https://timholy.github.io/SnoopCompile.jl/dev/
Other
309 stars 48 forks source link

SnoopPrecompile crashes Sunny on Windows #316

Closed kbarros closed 1 year ago

kbarros commented 1 year ago

It appears that SnoopPrecompile crashes for Windows users (but not Linux or Mac) when loading Sunny, at this commit.

The stack trace is:

┌ Info: Precompiling Sunny [2b4a2ac8-8f8b-43e8-abf4-3cb0c45e8736]
└ @ Base loading.jl:1662
ERROR: LoadError: SystemError: opening file "/dev/null": No such file or directory
Stacktrace:
  [1] systemerror(p::String, errno::Int32; extrainfo::Nothing)
    @ Base .\error.jl:176
  [2] #systemerror#80
    @ .\error.jl:175 [inlined]
  [3] systemerror
    @ .\error.jl:175 [inlined]
  [4] open(fname::String; lock::Bool, read::Nothing, write::Nothing, create::Nothing, truncate::Bool, append::Nothing)
    @ Base .\iostream.jl:293
  [5] open(fname::String, mode::String; lock::Bool)
    @ Base .\iostream.jl:356
  [6] open
    @ .\iostream.jl:355 [inlined]
  [7] macro expansion
    @ C:\Users\Windows\.julia\packages\Sunny\IMle8\src\Sunny.jl:122 [inlined]
  [8] top-level scope
    @ C:\Users\Windows\.julia\packages\SnoopPrecompile\UWvXF\src\SnoopPrecompile.jl:107
  [9] include
    @ .\Base.jl:419 [inlined]
 [10] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
    @ Base .\loading.jl:1554
 [11] top-level scope
    @ stdin:1
in expression starting at C:\Users\Windows\.julia\packages\Sunny\IMle8\src\Sunny.jl:1
in expression starting at stdin:1

Thanks.

timholy commented 1 year ago

This wasn't a SnoopPrecompile bug, it was a Sunny bug. The problem is that "/dev/null" isn't a file on Windows, thus the precompile workload the Sunny developers used wasn't Windows-compatible. Had they used Julia's own devull it probably would have worked.

But it looks like they removed the precompilation: https://github.com/SunnySuite/Sunny.jl/commit/e567fe7e3bf7fa14af1461ff089420300a61f5ba. (Seems unnecessary if they had just rewritten the precompile script to support Windows, and Julia 1.9 will get much more benefit from precompilation.) But they haven't made a new release in a while, you could ask them about that.