JuliaIO / VideoIO.jl

Reading and writing of video files in Julia via ffmpeg
https://juliaio.github.io/VideoIO.jl/stable
Other
126 stars 53 forks source link

Windows-based IOError #262

Closed TheCedarPrince closed 4 years ago

TheCedarPrince commented 4 years ago

Julia Version: 1.5

Platform(s): Linux (Fedora 32)

Bug Description:

Greetings from the Javis.jl team (ping @wikunia) ! We are currently working on a test case utilizing VideoIO and are having a strange error manifesting on Windows machines. Our test case currently has the simple line VideoIO.get_duration. This has been causing our tests to fail as well as the GitHub CI to fail with the error message:

IOError: unlink: resource busy or locked (EBUSY)

Any idea what this is and how to address this issue?

Additional Information:

Here is the test we have constructed that is giving us troubles:

@testset "Dancing circles (mp4)" begin
    p1 = Point(100, 0)
    p2 = Point(100, 80)
    from_rot = 0.0
    to_rot = 2π
    path_of_blue = Point[]
    path_of_red = Point[]

    video = Video(500, 500)
    javis(
        video,
        [
            BackgroundAction(
                1:5,
                ground,
                Rotation(0.0),
                Translation(Point(25, 25), Point(25, 25)),
            ),
            Action(latex_title),
            Action(
                Rel(-4:0),
                :red_ball,
                (args...) -> circ(p1, "red"),
                Rotation(from_rot, to_rot),
            ),
            Action(
                1:5,
                :blue_ball,
                (args...) -> circ(p2, "blue"),
                Rotation(to_rot, from_rot, :red_ball),
            ),
            Action(
                1:5,
                (video, args...) -> path!(path_of_red, get_position(:red_ball), "red"),
            ),
            Action(:same, (video, args...) -> path!(path_of_blue, pos(:blue_ball), "blue")),
            Action(1:5, (args...) -> rad(pos(:red_ball), pos(:blue_ball), "black")),
        ],
        tempdirectory = "images",
        pathname = "dancing.mp4",
    )

    @test VideoIO.get_duration("dancing.mp4") == 0.167
    rm("dancing.mp4")
end

Here is the stacktrace from the GitHub CI:

Dancing circles (mp4): Error During Test at D:aJavis.jlJavis.jl estanimations.jl:69
  Got exception outside of a @test
  IOError: unlink: resource busy or locked (EBUSY)
  Stacktrace:
   [1] uv_error at .libuv.jl:97 [inlined]
   [2] unlink(::String) at .file.jl:888
   [3] rm(::String; force::Bool, recursive::Bool) at .file.jl:268
   [4] rm(::String) at .file.jl:260
   [5] top-level scope at D:aJavis.jlJavis.jl   estanimations.jl:89
   [6] top-level scope at D:buildbotworkerpackage_win64buildusrsharejuliastdlibv1.5TestsrcTest.jl:1115
   [7] top-level scope at D:aJavis.jlJavis.jl   estanimations.jl:70
   [8] include(::String) at .client.jl:457
   [9] top-level scope at D:aJavis.jlJavis.jl   estruntests.jl:15
   [10] top-level scope at D:buildbotworkerpackage_win64buildusrsharejuliastdlibv1.5TestsrcTest.jl:1115
   [11] top-level scope at D:aJavis.jlJavis.jl  estruntests.jl:15
   [12] include(::String) at .client.jl:457
   [13] top-level scope at none:6
   [14] eval(::Module, ::Any) at .boot.jl:331
   [15] exec_options(::Base.JLOptions) at .client.jl:272
   [16] _start() at .client.jl:506

Here is the stacktrace from running test Javis on a Windows machine (thanks @merckxiaan):

Test Summary: | Pass  Total
Unit          |   23     23
┌ Warning: `latex(text::LaTeXString, fsize::Real)` is deprecated, use `begin
│     fontsize(fsize)
│     latex(text)
│ end` instead.
│   caller = (::var"#foreground#45")(::LaTeXString) at svg.jl:57
└ @ Main C:\Users\jules\.julia\packages\Javis\7kNk1\test\svg.jl:57
Test Summary:   | Pass  Total
SVG LaTeX tests |    3      3
Dancing circles (mp4): Error During Test at C:\Users\jules\.julia\packages\Javis\7kNk1\test\animations.jl:92
  Got exception outside of a @test
  IOError: unlink: resource busy or locked (EBUSY)
  Stacktrace:
   [1] uv_error at .\libuv.jl:97 [inlined]
   [2] unlink(::String) at .\file.jl:888
   [3] rm(::String; force::Bool, recursive::Bool) at .\file.jl:268
   [4] rm(::String) at .\file.jl:260
   [5] top-level scope at C:\Users\jules\.julia\packages\Javis\7kNk1\test\animations.jl:135
   [6] top-level scope at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Test\src\Test.jl:1113
   [7] top-level scope at C:\Users\jules\.julia\packages\Javis\7kNk1\test\animations.jl:93
   [8] include(::String) at .\client.jl:439
   [9] top-level scope at C:\Users\jules\.julia\packages\Javis\7kNk1\test\runtests.jl:15
   [10] top-level scope at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Test\src\Test.jl:1113
   [11] top-level scope at C:\Users\jules\.julia\packages\Javis\7kNk1\test\runtests.jl:15
   [12] include(::String) at .\client.jl:439
   [13] top-level scope at none:6
   [14] eval(::Module, ::Any) at .\boot.jl:331
   [15] exec_options(::Base.JLOptions) at .\client.jl:264
   [16] _start() at .\client.jl:484

Test Summary:                                   | Pass  Error  Total
Animations                                      |   22      1     23
  Dancing circles (gif)                         |    2             2
  Dancing circles (mp4)                         |    1      1      2
  Dancing circles layered                       |    1             1
  Dancing circles layered return Transformation |    1             1
  Drawing grid                                  |    4             4
  Use returned angle                            |    1             1
  morphing star2circle and back                 |    2             2
  House of Nicholas line_width                  |    3             3
  Circle/square appear opacity                  |    4             4
  test default kwargs                           |    2             2
  test @error .mp3                              |    1             1
ERROR: LoadError: Some tests did not pass: 22 passed, 0 failed, 1 errored, 0 broken.
in expression starting at C:\Users\jules\.julia\packages\Javis\7kNk1\test\runtests.jl:14
ERROR: Package Javis errored during testing

Attempted PR in Javis at Wikunia/Javis.jl#101