JuliaLang / JuliaLang/PackageCompiler.jl
[FR] Gracefully handle access denied error
- Dominant language
- Julia
- Stars
- 1.6k
- Forks
- 205
- Avg merge
- 18h 37m
- Merged PRs (30d)
- 7
Description
I am compiling system images regularly, and often I remember to do it when I am using Julia for something else.
However, in that case, the old sysimage is in use and can not be overwritten. This only happens after the sysimage is compiled it seems:
```
[ Info: PackageCompiler: Executing C:\Users\Dennis Bal\GeekyStuff\Julia\sysimage\sysimage_excecution_file.jl => C:\Users\DENNIS~1\AppData\Local\Temp\jl_packagecompiler_Nhzt9b\jl_18E1.tmp
[ Info: Running "sysimage_excecution_file.jl"!
[ Info: PackageCompiler: Done
⠙ [07m:23s] PackageCompiler: compiling incremental system image # I am pretty sure this line resulted from going fullscreen in the terminal
✔ [09m:32s] PackageCompiler: compiling incremental system image
C:/Users/Dennis Bal/.julia/artifacts/fdff308295487f361ef6e8dc2d27f5abe8a6eee9/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot open output file C:\Users\Dennis Bal\.julia\environments\v1.8\JuliaSysimage.dll: Permission denied
collect2.exe: error: ld returned 1 exit status
```
Full error message
```
ERROR: failed process: Process(setenv(`'C:\Users\Dennis Bal\.julia\artifacts\fdff308295487f361ef6e8dc2d27f5abe8a6eee9\mingw64\bin\g++.exe' -m64 -march=x86-64 -shared '-LC:\Users\Dennis Bal\.julia\juliaup\julia-1.8.0+0.x64\bin' '-LC:\Users\Dennis Bal\.julia\juliaup\julia-1.8.0+0.x64\bin' -o 'C:\Users\Dennis Bal\.julia\environments\v1.8\JuliaSysimage.dll' -Wl,--whole-archive 'C:\Users\DENNIS~1\AppData\Local\Temp\jl_zcT8DgbIX8.o' -Wl,--no-whole-archive -ljulia -ljulia-internal -lopenlibm -Wl,--export-all-symbols`,["PATH=C:\\Program Files\\PowerShell\\7;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;C:\\Program Files\\MATLAB\\R2021b\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\PowerShell\\7\\;C:\\Users\\Dennis Bal\\AppData\\Local\\Programs\\Quarto\\bin;C:\\Users\\Dennis Bal\\AppData\\Local\\Programs\\Python\\Python310\\Scripts\\;C:\\Users\\Dennis Bal\\AppData\\Local\\Programs\\Python\\Python310\\;C:\\Users\\Dennis Bal\\AppData\\Local\\Microsoft\\WindowsApps;C:\\MinGW\\bin;C:\\MinGW;C:\\Users\\Dennis Bal\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Program Files\\R\\R-4.1.2\\bin;C:\\texlive\\2022\\bin\\win32;C:\\Users\\Dennis Bal\\AppData\\Local\\Programs\\Python\\Python310;C:\\Users\\Dennis Bal\\.julia\\artifacts\\fdff308295487f361ef6e8dc2d27f5abe8a6eee9\\mingw64\\bin", "USERDOMAIN_ROAMINGPROFILE=Baltop", "WSLENV=WT_SESSION::WT_PROFILE_ID", "HOMEPATH=\\Users\\Dennis Bal", "PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL", "SYSTEMROOT=C:\\WINDOWS", "APPDATA=C:\\Users\\Dennis Bal\\AppData\\Roaming", "PSMODULEPATH=C:\\Users\\Dennis Bal\\Documents\\PowerShell\\Modules;C:\\Program Files\\PowerShell\\Modules;c:\\program files\\powershell\\7\\Modules;C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules", "COMMONPROGRAMW6432=C:\\Program Files\\Common Files", "PROGRAMDATA=C:\\ProgramData" … "COMMONPROGRAMFILES=C:\\Program Files\\Common Files", "ONEDRIVE=C:\\Users\\Dennis Bal\\OneDrive - Syddansk Universitet", "WT_SESSION=e0859a1b-04ba-4616-b85a-03dce8e17024", "PROGRAMFILES(X86)=C:\\Program Files (x86)", "PROGRAMFILES=C:\\Program Files", "LOGONSERVER=\\\\BALTOP", "DRIVERDATA=C:\\Windows\\System32\\Drivers\\DriverData", "POWERSHELL_DISTRIBUTION_CHANNEL=MSI:Windows 10 Pro", "SYSTEMDRIVE=C:", "PROCESSOR_ARCHITECTURE=AMD64"]), ProcessExited(1)) [1]
Stacktrace:
[1] pipeline_error
@ .\process.jl:565 [inlined]
[2] run(::Cmd; wait::Bool)
@ Base .\process.jl:480
[3] run
@ .\process.jl:477 [inlined]
[4] run_compiler(cmd::Cmd; cplusplus::Bool)
@ PackageCompiler C:\Users\Dennis Bal\.julia\packages\PackageCompiler\YNnEB\src\PackageCompiler.jl:164
[5] create_sysimg_from_object_file(object_files::Vector{String}, sysimage_path::String; version::Nothing, compat_level::String, soname::Nothing)
@ PackageCompiler C:\Users\Dennis Bal\.julia\packages\PackageCompiler\YNnEB\src\PackageCompiler.jl:557
[6] create_sysimage(packages::Vector{Symbol}; sysimage_path::String, project::String, precompile_execution_file::String, precompile_statements_file::Vector{String}, incremental::Bool, filter_stdlibs::Bool, cpu_target::String, script::Nothing, sysimage_build_args::Cmd, include_transitive_dependencies::Bool, base_sysimage::Nothing, julia_init_c_file::Nothing, version::Nothing, soname::Nothing, compat_level::String, extra_precompiles::String)
@ PackageCompiler C:\Users\Dennis Bal\.julia\packages\PackageCompiler\YNnEB\src\PackageCompiler.jl:524
[7] top-level scope
@ C:\Users\Dennis Bal\.julia\config\startup.jl:111
[8] eval
@ .\boot.jl:368 [inlined]
[9] eval
@ .\client.jl:478 [inlined]
[10] generate_sysimage()
@ Main C:\Users\Dennis Bal\.julia\config\startup.jl:116
[11] top-level scope
@ REPL[1]:1
```
Could this not be handled gracefully, so as to not loose the progress made and allow compiling new sysimages while using the old ones?
1) I am imagining two possibilities off the top of my head - prompt the user to close any julia-sessions that use the old sysimage, and when the user has done this, they can write "continue" to keep going.
2) Create the file, appending a number on the end, or "_new", or something to that effect. Warn the user. The user could then delete the old sysimage and rename the new one when they want to.
Contributor guide
No contributing guide indexed for this repository
Research direction
The stack trace points to PackageCompiler.jl, especially run_compiler, create_sysimg_from_object_file, and create_sysimage. Start by reading those entry points and trace the permission-denied path; done means a locked existing sysimage is handled without losing the compilation progress and the user receives a usable recovery path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100