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
read with default keyword arguments (sometimes?) leave .tif files "open". That is, I can't remove test files without closing Julia first.
When
In Windows OS, this happens with files made from scratch in GeoArrays.jl, and files downloaded from different sources. I don't believe the file content is the cause. The files can't be deleted from Powershell or Explorer, because they are 'open in Julia programming language'. Have not tested on other OS.
julia> fn = "Consolidated.tif";
julia> GeoArrays.read(fn)
155x155x1 Array{Float32, 3} with AffineMap([1.0 0.0; 0.0 -1.0], [18294.0, 6.937717e6]) and undefined CRS
julia> rm(fn)
ERROR: IOError: unlink("Consolidated.tif"): resource busy or locked (EBUSY)
...
Reading other files does not release the first file. After closing Julia, the files can be deleted.
Why
Not pinned down, perhaps some non-conforming ccalls? I could not find issues with the libraries online.
Workarounds
a) Drop cleaning up. This makes testing fail in some contexts.
b) Instead of read:
"""
readclose(fnam)
A barrier for a possible issue with GeoArrays libraries. Keyword arguments not included.
"""
function readclose(fnam)
file_task = Threads.@spawn GeoArrays.read(fnam)
contents = fetch(file_task)
GC.gc() # Clean up resources explicitly after the operation
contents::GeoArray # Type guarantee for the compiler, just like `read`
end
The text was updated successfully, but these errors were encountered:
Thanks for making an issue, and great to see suggestions on a possible fix.
I've indeed seen such errors on Windows CI, but I thought it stemmed from lazy reading, but that should not happen with default kwargs. Let me investigate.
Thanks for the quick response.
I'm new to rasters and to this package, so it took a while for me to figure out that the returned GeoArray is sometimes lazy. Does the compiler know that, and compile methods for both cases? And perhaps, does it not release the reference because some method unnecessarily assumes that a geoarray is lazy?
What happens
read
with default keyword arguments (sometimes?) leave .tif files "open". That is, I can't remove test files without closing Julia first.When
In Windows OS, this happens with files made from scratch in GeoArrays.jl, and files downloaded from different sources. I don't believe the file content is the cause. The files can't be deleted from Powershell or Explorer, because they are 'open in Julia programming language'. Have not tested on other OS.
Reading other files does not release the first file. After closing Julia, the files can be deleted.
Why
Not pinned down, perhaps some non-conforming ccalls? I could not find issues with the libraries online.
Workarounds
a) Drop cleaning up. This makes testing fail in some contexts.
b) Instead of
read
:The text was updated successfully, but these errors were encountered: