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

Windows: resource busy or locked (EBUSY) #124

Open
pxl-th opened this issue Nov 22, 2023 · 5 comments
Open

Windows: resource busy or locked (EBUSY) #124

pxl-th opened this issue Nov 22, 2023 · 5 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@pxl-th
Copy link

pxl-th commented Nov 22, 2023

After finishing running testsuite this error appears on Windows:

ERROR: LoadError: IOError: unlink("C:\\Users\\tonys\\AppData\\Local\\Temp\\ReTestItemsTempLogsDirectory\\ReTestItems_setup_TSCore_12038651198515000257.log"): resource busy or locked (EBUSY)
Stacktrace:
  [1] uv_error
    @ Base .\libuv.jl:100 [inlined]
  [2] unlink(p::String)
    @ Base.Filesystem .\file.jl:978
  [3] rm(path::String; force::Bool, recursive::Bool)
    @ Base.Filesystem .\file.jl:283
  [4] rm
    @ .\file.jl:273 [inlined]
  [5] foreach(f::ReTestItems.var"#16#17"{ReTestItems.TestItems}, itr::Vector{Union{ReTestItems.DirNode, ReTestItems.FileNode}})
    @ Base .\abstractarray.jl:3086 [inlined]
  [6] _runtests_in_current_env(shouldrun::Function, paths::Tuple{String}, projectfile::String, nworkers::Int64, nworker_threads::String, worker_init_expr::Expr, test_end_expr::Expr, testitem_timeout::Int64, retries::Int64, memory_threshold::Float64, verbose_results::Bool, debug::Int64, report::Bool, logs::Symbol)
    @ ReTestItems C:\Users\tonys\.julia\packages\ReTestItems\HZCMZ\src\ReTestItems.jl:378
  [7] (::ReTestItems.var"#46#47"{ReTestItems.var"#shouldrun_combined#44"{Nothing, Nothing, var"#4#5"}, Tuple{String}, Int64, String, Expr, Expr, Int64, Int64, Float64, Bool, Int64, Bool, Symbol, String})()
    @ ReTestItems C:\Users\tonys\.julia\packages\ReTestItems\HZCMZ\src\ReTestItems.jl:278
  [8] with_logstate(f::Function, logstate::Any)
    @ Base.CoreLogging .\logging.jl:515
  [9] with_logger
    @ .\logging.jl:627 [inlined]
 [10] _runtests(shouldrun::Function, paths::Tuple{String}, nworkers::Int64, nworker_threads::String, worker_init_expr::Expr, test_end_expr::Expr, testitem_timeout::Int64, retries::Int64, memory_threshold::Float64, verbose_results::Bool, debug::Int64, report::Bool, logs::Symbol)
    @ ReTestItems C:\Users\tonys\.julia\packages\ReTestItems\HZCMZ\src\ReTestItems.jl:274
 [11] runtests(shouldrun::var"#4#5", paths::String; nworkers::Int64, nworker_threads::Int64, worker_init_expr::Expr, testitem_timeout::Int64, retries::Int64, memory_threshold::Float64, debug::Int64, name::Nothing, tags::Nothing, report::Bool, logs::Symbol, verbose_results::Bool, test_end_expr::Expr)
    @ ReTestItems C:\Users\tonys\.julia\packages\ReTestItems\HZCMZ\src\ReTestItems.jl:244
 [12] #runtests#39
    @ ReTestItems C:\Users\tonys\.julia\packages\ReTestItems\HZCMZ\src\ReTestItems.jl:196 [inlined]
 [13] top-level scope
    @ C:\Users\tonys\.julia\dev\AMDGPU\test\runtests.jl:114
 [14] include(fname::String)
    @ Base.MainInclude .\client.jl:489
 [15] top-level scope
    @ none:6
in expression starting at C:\Users\tonys\.julia\dev\AMDGPU\test\runtests.jl:114
@pxl-th
Copy link
Author

pxl-th commented Nov 22, 2023

Actually that does not happen all the time... Maybe it was a fluke

@nickrobinson251
Copy link
Collaborator

please re-open if this keeps happening

@awadell1
Copy link

I'm able to reproduce this fairly reliable here: https://github.com/awadell1/PkgJogger.jl/actions/runs/7223307848/job/19682092814?pr=69

ERROR: LoadError: IOError: unlink("C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\ReTestItemsTempLogsDirectory\\ReTestItems_setup_BenchmarkTests_12830300838977983825.log"): resource busy or locked (EBUSY)
Stacktrace:
  [1] uv_error
    @ .\libuv.jl:100 [inlined]
  [2] unlink(p::String)
    @ Base.Filesystem .\file.jl:974
  [3] rm(path::String; force::Bool, recursive::Bool)
    @ Base.Filesystem .\file.jl:283
  [4] rm
    @ .\file.jl:273 [inlined]
  [5] foreach
    @ .\abstractarray.jl:3075 [inlined]
  [6] _runtests_in_current_env(shouldrun::Function, paths::Tuple{String}, projectfile::String, nworkers::Int64, nworker_threads::String, worker_init_expr::Expr, test_end_expr::Expr, testitem_timeout::Int64, retries::Int64, memory_threshold::Float64, verbose_results::Bool, debug::Int64, report::Bool, logs::Symbol)
    @ ReTestItems C:\Users\runneradmin\.julia\packages\ReTestItems\rzEcY\src\ReTestItems.jl:394
  [7] (::ReTestItems.var"#46#47"{ReTestItems.var"#shouldrun_combined#44"{Nothing, Nothing, typeof(ReTestItems.default_shouldrun)}, Tuple{String}, Int64, String, Expr, Expr, Int64, Int64, Float64, Bool, Int64, Bool, Symbol, String})()
    @ ReTestItems C:\Users\runneradmin\.julia\packages\ReTestItems\rzEcY\src\ReTestItems.jl:294
  [8] with_logstate(f::Function, logstate::Any)
    @ Base.CoreLogging .\logging.jl:514
  [9] with_logger
    @ .\logging.jl:626 [inlined]
 [10] _runtests(shouldrun::Function, paths::Tuple{String}, nworkers::Int64, nworker_threads::String, worker_init_expr::Expr, test_end_expr::Expr, testitem_timeout::Int64, retries::Int64, memory_threshold::Float64, verbose_results::Bool, debug::Int64, report::Bool, logs::Symbol)
    @ ReTestItems C:\Users\runneradmin\.julia\packages\ReTestItems\rzEcY\src\ReTestItems.jl:290
 [11] runtests(shouldrun::typeof(ReTestItems.default_shouldrun), paths::String; nworkers::Int64, nworker_threads::String, worker_init_expr::Expr, testitem_timeout::Float64, retries::Int64, memory_threshold::Float64, debug::Int64, name::Nothing, tags::Nothing, report::Bool, logs::Symbol, verbose_results::Bool, test_end_expr::Expr, validate_paths::Bool)
    @ ReTestItems C:\Users\runneradmin\.julia\packages\ReTestItems\rzEcY\src\ReTestItems.jl:260
 [12] runtests(shouldrun::Function, paths::String)
    @ ReTestItems C:\Users\runneradmin\.julia\packages\ReTestItems\rzEcY\src\ReTestItems.jl:221
 [13] #runtests#41
    @ C:\Users\runneradmin\.julia\packages\ReTestItems\rzEcY\src\ReTestItems.jl:218 [inlined]
 [14] runtests
    @ C:\Users\runneradmin\.julia\packages\ReTestItems\rzEcY\src\ReTestItems.jl:215 [inlined]
 [15] #runtests#40
    @ C:\Users\runneradmin\.julia\packages\ReTestItems\rzEcY\src\ReTestItems.jl:214 [inlined]
 [16] runtests(pkg::Module)
    @ ReTestItems C:\Users\runneradmin\.julia\packages\ReTestItems\rzEcY\src\ReTestItems.jl:214
 [17] top-level scope
    @ D:\a\PkgJogger.jl\PkgJogger.jl\test\runtests.jl:2
 [18] include(fname::String)
    @ Base.MainInclude .\client.jl:478
 [19] top-level scope
    @ none:6
in expression starting at D:\a\PkgJogger.jl\PkgJogger.jl\test\runtests.jl:2
ERROR: LoadError: Package PkgJogger errored during testing
Stacktrace:
 [1] pkgerror(msg::String)
   @ Pkg.Types C:\hostedtoolcache\windows\julia\1.9.4\x64\share\julia\stdlib\v1.9\Pkg\src\Types.jl:69
 [2] test(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; coverage::Bool, julia_args::Cmd, test_args::Cmd, test_fn::Nothing, force_latest_compatible_version::Bool, allow_earlier_backwards_compatible_versions::Bool, allow_reresolve::Bool)
   @ Pkg.Operations C:\hostedtoolcache\windows\julia\1.9.4\x64\share\julia\stdlib\v1.9\Pkg\src\Operations.jl:2019
 [3] test
   @ C:\hostedtoolcache\windows\julia\1.9.4\x64\share\julia\stdlib\v1.9\Pkg\src\Operations.jl:1900 [inlined]
 [4] test(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; coverage::Bool, test_fn::Nothing, julia_args::Vector{String}, test_args::Cmd, force_latest_compatible_version::Bool, allow_earlier_backwards_compatible_versions::Bool, allow_reresolve::Bool, kwargs::Base.Pairs{Symbol, IOContext{Base.PipeEndpoint}, Tuple{Symbol}, NamedTuple{(:io,), Tuple{IOContext{Base.PipeEndpoint}}}})
   @ Pkg.API C:\hostedtoolcache\windows\julia\1.9.4\x64\share\julia\stdlib\v1.9\Pkg\src\API.jl:441
 [5] test(pkgs::Vector{Pkg.Types.PackageSpec}; io::IOContext{Base.PipeEndpoint}, kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:coverage, :julia_args, :force_latest_compatible_version), Tuple{Bool, Vector{String}, Bool}}})
   @ Pkg.API C:\hostedtoolcache\windows\julia\1.9.4\x64\share\julia\stdlib\v1.9\Pkg\src\API.jl:156
 [6] test(; name::Nothing, uuid::Nothing, version::Nothing, url::Nothing, rev::Nothing, path::Nothing, mode::Pkg.Types.PackageMode, subdir::Nothing, kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:coverage, :julia_args, :force_latest_compatible_version), Tuple{Bool, Vector{String}, Bool}}})
   @ Pkg.API C:\hostedtoolcache\windows\julia\1.9.4\x64\share\julia\stdlib\v1.9\Pkg\src\API.jl:171
 [7] top-level scope
   @ D:\a\_actions\julia-actions\julia-runtest\v1\test_harness.jl:15
 [8] include(fname::String)
   @ Base.MainInclude .\client.jl:478
 [9] top-level scope
   @ none:1
in expression starting at D:\a\_actions\julia-actions\julia-runtest\v1\test_harness.jl:7

@nickrobinson251 nickrobinson251 added bug Something isn't working help wanted Extra attention is needed labels Feb 15, 2024
@avik-pal
Copy link

Is there any known workaround for this issue? We are seeing it consistently in https://github.com/SciML/NonlinearSolve.jl

@nickrobinson251
Copy link
Collaborator

nickrobinson251 commented Nov 19, 2024

I'm basically offline til the new year. @Drvi are you perhaps able to take a look?

Seems to be happening here

# Cleanup test setup logs
foreach(Iterators.filter(endswith(".log"), readdir(RETESTITEMS_TEMP_FOLDER[], join=true))) do logfile
rm(logfile; force=true) # `force` to ignore error if file already cleaned up
end

Maybe since this is in tmpdir we don't even need to cllean these up ourselves? Or at least we could wrap this in a try catch where the catch does nothing or maybe just logs a debug message about the error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants