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

Testing locally on Windows fails with EBUSY IOError #12

Closed
daschw opened this issue Aug 19, 2024 · 3 comments
Closed

Testing locally on Windows fails with EBUSY IOError #12

daschw opened this issue Aug 19, 2024 · 3 comments

Comments

@daschw
Copy link
Collaborator

daschw commented Aug 19, 2024

If I run the tests locally on Windows, the removing of log-files fails with

LoadError: IOError: unlink("$LOG_FILE_PATH"): resource busy or locked (EBUSY)

I suppose it has something to do with not closing log-files correctly in the logging code, but I'm not sure yet.

Below you can find the REPL log of a local test run. All tests pass, but removing some of the log-files errors.

(IESopt) pkg> test
     Testing IESopt
      Status `C:\Users\SchwabenederD\AppData\Local\Temp\jl_YBrCVn\Project.toml`
  [4c88cf16] Aqua v0.8.7
  [87dc4568] HiGHS v1.9.2
  [ed3f0a38] IESopt v1.0.4 `C:\Users\SchwabenederD\.julia\dev\IESopt`
  [b98f706d] IESoptLib v0.2.0
  [c3a54625] JET v0.9.8
  [4076af6c] JuMP v1.23.0
  [fd094767] Suppressor v0.2.7
  [8dfed614] Test
      Status `C:\Users\SchwabenederD\AppData\Local\Temp\jl_YBrCVn\Manifest.toml`
  [4c88cf16] Aqua v0.8.7
  [dce04be8] ArgCheck v2.3.0
  [6e4b80f9] BenchmarkTools v1.5.0
  [336ed68f] CSV v0.10.14
  [da1fd8a2] CodeTracking v1.3.6
  [523fee87] CodecBzip2 v0.8.4
  [944b1d66] CodecZlib v0.7.6
  [861a8166] Combinatorics v1.0.2
  [bbf7d656] CommonSubexpressions v0.3.0
  [34da2185] Compat v4.16.0
  [a8cc5b0e] Crayons v4.1.1
  [9a962f9c] DataAPI v1.16.0
  [a93c6f00] DataFrames v1.6.1
  [864edb3b] DataStructures v0.18.20
  [e2d170a0] DataValueInterfaces v1.0.0
  [163ba53b] DiffResults v1.1.0
  [b552c78f] DiffRules v1.15.1
  [ffbed154] DocStringExtensions v0.9.3
  [e2ba6199] ExprTools v0.1.10
  [5789e2e9] FileIO v1.16.3
  [48062228] FilePathsBase v0.9.21
  [f6369f11] ForwardDiff v0.10.36
  [87dc4568] HiGHS v1.9.2
  [ed3f0a38] IESopt v1.0.4 `C:\Users\SchwabenederD\.julia\dev\IESopt`
  [b98f706d] IESoptLib v0.2.0
  [842dd82b] InlineStrings v1.4.2
  [41ab1584] InvertedIndices v1.3.0
  [92d709cd] IrrationalConstants v0.2.2
  [82899510] IteratorInterfaceExtensions v1.0.0
  [c3a54625] JET v0.9.8
  [033835bb] JLD2 v0.4.51
  [692b3bcd] JLLWrappers v1.5.0
  [682c06a0] JSON v0.21.4
  [4076af6c] JuMP v1.23.0
  [aa1ae85d] JuliaInterpreter v0.9.34
  [b964fa9f] LaTeXStrings v1.3.1
  [2ab3a3ac] LogExpFunctions v0.3.28
  [e6f89c97] LoggingExtras v1.0.3
  [6f1432cf] LoweredCodeUtils v3.0.1
  [1914dd2f] MacroTools v0.5.13
  [b8f27783] MathOptInterface v1.31.1
  [e1d29d7a] Missings v1.2.0
  [0327d340] MultiObjectiveAlgorithms v1.3.3
  [d8a4904e] MutableArithmetics v1.4.6
  [77ba4419] NaNMath v1.0.2
  [bac558e1] OrderedCollections v1.6.3
  [69de0a69] Parsers v2.8.1
  [2dfb63ee] PooledArrays v1.4.3
  [aea7be01] PrecompileTools v1.2.1
  [21216c6a] Preferences v1.4.3
  [08abe8d2] PrettyTables v2.3.2
  [92933f4c] ProgressMeter v1.10.2
  [189a3867] Reexport v1.2.2
  [ae029012] Requires v1.3.0
  [7e49a35a] RuntimeGeneratedFunctions v0.5.13
  [91c51154] SentinelArrays v1.4.5
  [a2af1166] SortingAlgorithms v1.2.1
  [276daf66] SpecialFunctions v2.4.0
  [1e83bf80] StaticArraysCore v1.4.3
  [69024149] StringEncodings v0.3.7
  [892a3eda] StringManipulation v0.3.4
  [fd094767] Suppressor v0.2.7
  [3783bdb8] TableTraits v1.0.1
  [bd369af6] Tables v1.12.0
  [9ac5f52a] Tectonic v0.8.0
  [3bb67fe8] TranscodingStreams v0.11.2
  [ea10d353] WeakRefStrings v1.4.2
  [76eceee3] WorkerUtilities v1.6.1
  [ddb6d928] YAML v0.4.12
  [a5390f91] ZipFile v0.10.1
  [6e34b625] Bzip2_jll v1.0.8+1
  [8fd58aa0] HiGHS_jll v1.7.2+0
  [94ce4f54] Libiconv_jll v1.17.0+0
  [efe28fd5] OpenSpecFun_jll v0.5.5+0
  [0dad84c5] ArgTools v1.1.1
  [56f22d72] Artifacts
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [8ba89e20] Distributed
  [f43a241f] Downloads v1.6.0
  [7b1f6079] FileWatching
  [9fa8497b] Future
  [b77e0a4c] InteractiveUtils
  [b27032c2] LibCURL v0.6.4
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [a63ad114] Mmap
  [ca575930] NetworkOptions v1.2.0
  [44cfe95a] Pkg v1.10.0
  [de0858da] Printf
  [9abbd945] Profile
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA v0.7.0
  [9e88b42a] Serialization
  [6462fe0b] Sockets
  [2f01184e] SparseArrays v1.10.0
  [10745b16] Statistics v1.10.0
  [fa267f1f] TOML v1.0.3
  [a4e569a6] Tar v1.10.0
  [8dfed614] Test
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode
  [e66e0078] CompilerSupportLibraries_jll v1.1.1+0
  [deac9b47] LibCURL_jll v8.4.0+0
  [e37daf67] LibGit2_jll v1.6.4+0
  [29816b5a] LibSSH2_jll v1.11.0+1
  [c8ffd9c3] MbedTLS_jll v2.28.2+1
  [14a3606d] MozillaCACerts_jll v2023.1.10
  [4536629a] OpenBLAS_jll v0.3.23+4
  [05823500] OpenLibm_jll v0.8.1+2
  [bea87d4a] SuiteSparse_jll v7.2.1+1
  [83775a58] Zlib_jll v1.2.13+1
  [8e850b90] libblastrampoline_jll v5.8.0+1
  [8e850ede] nghttp2_jll v1.52.0+1
  [3f19e933] p7zip_jll v17.4.0+2
Precompiling project...
  1 dependency successfully precompiled in 34 seconds. 84 already precompiled.
  1 dependency had output during precompilation:
┌ IESopt
│  ┌ Warning: Detected precompilation... limiting Snapshot count
│  │   original = 4
│  │   new = 4
│  └ @ IESopt C:\Users\SchwabenederD\.julia\dev\IESopt\src\config\optimization.jl:83
│  ┌ Warning: Detected precompilation... limiting Snapshot count
│  │   original = 24
│  │   new = 4
│  └ @ IESopt C:\Users\SchwabenederD\.julia\dev\IESopt\src\config\optimization.jl:83
│  ┌ Warning: Detected precompilation... limiting Snapshot count
│  │   original = 8760
│  │   new = 4
│  └ @ IESopt C:\Users\SchwabenederD\.julia\dev\IESopt\src\config\optimization.jl:83
│  ┌ Warning: Detected precompilation... limiting Snapshot count
│  │   original = 24
│  │   new = 4
│  └ @ IESopt C:\Users\SchwabenederD\.julia\dev\IESopt\src\config\optimization.jl:83
└
     Testing Running tests...
Basic (IESopt.jl): Error During Test at C:\Users\SchwabenederD\.julia\dev\IESopt\test\runtests.jl:24
  Got exception outside of a @test
  LoadError: IOError: unlink("C:\\Users\\SchwabenederD\\.julia\\dev\\IESopt\\test\\test_files\\out\\my_model\\scenario_2024_08_19_121054196.log"): resource busy or locked (EBUSY)
  Stacktrace:
    [1] uv_error
      @ .\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(path::String; force::Bool, recursive::Bool) (repeats 2 times)
      @ Base.Filesystem .\file.jl:294
    [5] top-level scope
      @ C:\Users\SchwabenederD\.julia\dev\IESopt\test\src\basic.jl:52
    [6] include(fname::String)
      @ Base.MainInclude .\client.jl:489
    [7] macro expansion
      @ C:\Users\SchwabenederD\.julia\dev\IESopt\test\runtests.jl:25 [inlined]
    [8] macro expansion
      @ C:\Users\SchwabenederD\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Test\src\Test.jl:1577 [inlined]
    [9] macro expansion
      @ C:\Users\SchwabenederD\.julia\dev\IESopt\test\runtests.jl:25 [inlined]
   [10] macro expansion
      @ C:\Users\SchwabenederD\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Test\src\Test.jl:1577 [inlined]
   [11] top-level scope
      @ C:\Users\SchwabenederD\.julia\dev\IESopt\test\runtests.jl:12
   [12] include(fname::String)
      @ Base.MainInclude .\client.jl:489
   [13] top-level scope
      @ none:6
   [14] eval
      @ .\boot.jl:385 [inlined]
   [15] exec_options(opts::Base.JLOptions)
      @ Base .\client.jl:291
   [16] _start()
      @ Base .\client.jl:552
  in expression starting at C:\Users\SchwabenederD\.julia\dev\IESopt\test\src\basic.jl:52
Examples (IESopt.jl): Error During Test at C:\Users\SchwabenederD\.julia\dev\IESopt\test\runtests.jl:28
  Got exception outside of a @test
  LoadError: IOError: unlink("C:\\Users\\SchwabenederD\\.julia\\packages\\IESoptLib\\Hdi46\\assets\\examples\\out\\my_model\\scenario_2024_08_19_121106715.log"): resource busy or locked (EBUSY)
  Stacktrace:
    [1] uv_error
      @ .\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(path::String; force::Bool, recursive::Bool) (repeats 2 times)
      @ Base.Filesystem .\file.jl:294
    [5] top-level scope
      @ C:\Users\SchwabenederD\.julia\dev\IESopt\test\src\examples.jl:161
    [6] include(fname::String)
      @ Base.MainInclude .\client.jl:489
    [7] macro expansion
      @ C:\Users\SchwabenederD\.julia\dev\IESopt\test\runtests.jl:31 [inlined]
    [8] macro expansion
      @ C:\Users\SchwabenederD\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Test\src\Test.jl:1577 [inlined]
    [9] macro expansion
      @ C:\Users\SchwabenederD\.julia\dev\IESopt\test\runtests.jl:29 [inlined]
   [10] macro expansion
      @ C:\Users\SchwabenederD\.julia\juliaup\julia-1.10.4+0.x64.w64.mingw32\share\julia\stdlib\v1.10\Test\src\Test.jl:1577 [inlined]
   [11] top-level scope
      @ C:\Users\SchwabenederD\.julia\dev\IESopt\test\runtests.jl:12
   [12] include(fname::String)
      @ Base.MainInclude .\client.jl:489
   [13] top-level scope
      @ none:6
   [14] eval
      @ .\boot.jl:385 [inlined]
   [15] exec_options(opts::Base.JLOptions)
      @ Base .\client.jl:291
   [16] _start()
      @ Base .\client.jl:552
  in expression starting at C:\Users\SchwabenederD\.julia\dev\IESopt\test\src\examples.jl:161
Test Summary:                                   | Pass  Error  Total   Time
IESopt.jl                                       |   95      2     97  39.4s
  Code quality (Aqua.jl)                        |   10            10  10.8s
  Code linting (JET.jl)                         |               None   0.0s
  Unit tests (IESopt.jl)                        |   23            23   0.1s
  Basic (IESopt.jl)                             |   25      1     26   4.1s
    Basic models                                |    4             4   2.5s
    Filesystem paths                            |   21            21   0.8s
      include_components                        |    3             3   0.6s
      include_components_slash                  |    3             3   0.1s
      include_dotslash_components               |    3             3   0.1s
      include_dotslash_components_slash         |    3             3   0.0s
      include_components_slash_windows          |    3             3   0.0s
      include_dotslash_components_windows       |    3             3   0.0s
      include_dotslash_components_slash_windows |    3             3   0.0s
  Examples (IESopt.jl)                          |   37      1     38  24.4s
    01_basic_single_node                        |    1             1   0.2s
    02_advanced_single_node                     |    1             1   0.3s
    03_basic_two_nodes                          |    1             1   0.2s
    05_basic_two_nodes_1y                       |    1             1   1.9s
    06_recursion_h2                             |    1             1   0.2s
    07_csv_filestorage                          |    1             1   1.5s
    08_basic_investment                         |    1             1   0.2s
    09_csv_only                                 |    1             1   1.4s
    10_basic_load_shedding                      |    1             1   0.3s
    11_basic_unit_commitment                    |    1             1   0.8s
    12_incremental_efficiency                   |    1             1   0.3s
    15_varying_efficiency                       |    1             1   1.2s
    16_noncore_components                       |    1             1   3.2s
    17_varying_connection_capacity              |    1             1   0.2s
    18_addons                                   |    1             1   0.7s
    25_global_parameters                        |    1             1   0.3s
    25_global_parameters                        |    1             1   0.1s
    26_initial_states                           |    1             1   0.6s
    26_initial_states                           |    1             1   0.2s
    27_piecewise_linear_costs                   |    1             1   0.1s
    29_advanced_unit_commitment                 |    1             1   0.4s
    30_representative_snapshots                 |    1             1   1.2s
    44_lossy_connections                        |    1             1   0.2s
    04_constraint_safety                        |    2             2   1.8s
    20_chp                                      |    3             3   0.7s
    snapshots (22 and 23)                       |    2             2   0.4s
    31_exclusive_operation                      |    3             3   0.6s
    37_certificates                             |    3             3   3.5s
    47_disable_components                       |    1             1   1.2s
ERROR: LoadError: Some tests did not pass: 95 passed, 0 failed, 2 errored, 0 broken.
in expression starting at C:\Users\SchwabenederD\.julia\dev\IESopt\test\runtests.jl:11
ERROR: Package IESopt errored during testing
@sstroemer
Copy link
Member

While this needs to be fixed, one thought before we track it down: Should we disable log-to-file in the tests (or even all examples)? This just clogs the out folder (especially since they contain timestamps) and probably slows down the tests without any significant gain1.

Footnotes

  1. We could just unit test the file logger separately, and then disable that completely for everything else.

@daschw
Copy link
Collaborator Author

daschw commented Aug 19, 2024

Yes, I think it makes sense to disable log-to-file in all examples.

@sstroemer
Copy link
Member

Fixed by #31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants