You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ImageMagick v0.7.1
FileIO v1.0.4
Windows 10 x64 17763
When a file is loaded with an open IOStream (MagickReadImageFile), the file gets locked until the julia process exits. However the native MagickReadImage function (called by load(filename)) can release the file correctly.
To reproduce this problem, open a PWSH (elevated):
PS C:\> Copy-Item .\img1.jpg -Destination img2.jpg
PS C:\> julia --banner=no
julia> using Images
julia> using FileIO
julia> size(load("img1.jpg"))
(1080, 1920)
julia> rm("img1.jpg")
julia> io=open("img2.jpg")
IOStream(<file img2.jpg>)
julia> size(load(io))
(1080, 1920)
julia> close(io)
julia> rm("img2.jpg")
ERROR: IOError: unlink: resource busy or locked (EBUSY)
Stacktrace:
[1] uv_error at .\libuv.jl:85 [inlined]
[2] unlink(::String) at .\file.jl:722
[3] #rm#9(::Bool, ::Bool, ::Function, ::String) at .\file.jl:253
[4] rm(::String) at .\file.jl:245
[5] top-level scope at none:0
julia> exit()
PS C:\> Remove-Item .\img2.jpg
PS C:\>
The text was updated successfully, but these errors were encountered:
The HANDLE to img2.jpg is duplicated somewhere (after calling load(io)), and close(io) can only close the original HANDLE. If I force close the duplicated handle in procexp, the file is released then.
------UPDATE
This bug is caused by Libc.FILE(stream) in read/writeimage function, which dup() the file HANDLE.
azurefx
added a commit
to azurefx/ImageMagick.jl
that referenced
this issue
Dec 6, 2018
ImageMagick v0.7.1
FileIO v1.0.4
Windows 10 x64 17763
When a file is loaded with an open IOStream (MagickReadImageFile), the file gets locked until the julia process exits. However the native MagickReadImage function (called by load(filename)) can release the file correctly.
To reproduce this problem, open a PWSH (elevated):
The text was updated successfully, but these errors were encountered: