Skip to content

Error: mktempdir cleanup - IOError: rm... resource busy or locked (EBUSY) on Windows #39457

@IanButterworth

Description

@IanButterworth

This is seen quite frequently on Pkg's windows tests. I also had to add time delay to file write & rewrite benchmarks on Windows in SystemBenchmark to avoid writing to files that weren't closed yet.
Seems like the file isn't being reliably released during close?

For instance:

┌ Error: mktempdir cleanup
│   exception =
│    IOError: rm("C:\\Users\\runneradmin\\AppData\\Local\\Temp\\jl_rwp162\\HelloWorld"): resource busy or locked (EBUSY)
│    Stacktrace:
│      [1] uv_error
│        @ .\libuv.jl:97 [inlined]
│      [2] rm(path::String; force::Bool, recursive::Bool)
│        @ Base.Filesystem .\file.jl:289
│      [3] rm(path::String; force::Bool, recursive::Bool)
│        @ Base.Filesystem .\file.jl:282
│      [4] mktempdir(fn::Main.PkgTests.REPLTests.var"#26#36", parent::String; prefix::String)
│        @ Base.Filesystem .\file.jl:739
│      [5] mktempdir
│        @ .\file.jl:732 [inlined]
│      [6] #22
│        @ C:\hostedtoolcache\windows\julia\nightly\x64\share\julia\stdlib\v1.7\Pkg\test\repl.jl:174 [inlined]
│      [7] cd(f::Main.PkgTests.REPLTests.var"#22#32", dir::String)
│        @ Base.Filesystem .\file.jl:95
│      [8] #21
│        @ C:\hostedtoolcache\windows\julia\nightly\x64\share\julia\stdlib\v1.7\Pkg\test\repl.jl:149 [inlined]
│      [9] (::Main.PkgTests.Utils.var"#10#12"{Bool, Main.PkgTests.REPLTests.var"#21#31"})()
│        @ Main.PkgTests.Utils C:\hostedtoolcache\windows\julia\nightly\x64\share\julia\stdlib\v1.7\Pkg\test\utils.jl:107
│     [10] withenv(::Main.PkgTests.Utils.var"#10#12"{Bool, Main.PkgTests.REPLTests.var"#21#31"}, ::Pair{String, Nothing}, ::Vararg{Pair{String, Nothing}})
│        @ Base .\env.jl:161
│     [11] temp_pkg_dir(fn::Main.PkgTests.REPLTests.var"#21#31"; rm::Bool)
│        @ Main.PkgTests.Utils C:\hostedtoolcache\windows\julia\nightly\x64\share\julia\stdlib\v1.7\Pkg\test\utils.jl:98
│     [12] temp_pkg_dir(fn::Function)
│        @ Main.PkgTests.Utils C:\hostedtoolcache\windows\julia\nightly\x64\share\julia\stdlib\v1.7\Pkg\test\utils.jl:78
│     [13] top-level scope
│        @ C:\hostedtoolcache\windows\julia\nightly\x64\share\julia\stdlib\v1.7\Pkg\test\repl.jl:149
│     [14] include(mod::Module, _path::String)
│        @ Base .\Base.jl:386
│     [15] include(x::String)
│        @ Main.PkgTests C:\hostedtoolcache\windows\julia\nightly\x64\share\julia\stdlib\v1.7\Pkg\test\runtests.jl:3
│     [16] top-level scope
│        @ C:\hostedtoolcache\windows\julia\nightly\x64\share\julia\stdlib\v1.7\Pkg\test\runtests.jl:23
│     [17] include(fname::String)
│        @ Base.MainInclude .\client.jl:451
│     [18] top-level scope
│        @ none:6
│     [19] eval
│        @ .\boot.jl:369 [inlined]
│     [20] exec_options(opts::Base.JLOptions)
│        @ Base .\client.jl:268
│     [21] _start()
│        @ Base .\client.jl:492
└ @ Base.Filesystem file.jl:742

Related issues
#29658
#27982

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions