Closed evetion closed 3 years ago
Not directly. Something is perhaps not closed in the right order or something like that. Do you have a small example that we can start testing this out?
The error message appears with Pkg.test("ArchGDAL")
but not with include("runtests.jl")
from the test directory
@visr have you already look into the possibility to make for Julia something equivalent of Python's <module>.UseExceptions()
?
This in order to identify better where the error message from come from.
I think we have that, and it's enabled by default. Evey time you get a GDALError
it is a Julia Exception thrown by an error in GDAL, see https://github.com/JuliaGeo/GDAL.jl/blob/master/src/error.jl.
If you can reliably trigger the issue, perhaps the quickest way to locate it is with some print statements in between the tests. Not sure why there is a difference between how you run the tests, unless the session and hence the handles are kept alive in one case but not the other.
I have browsed the code of GDAL.jl/src/error.jl and GDAL.jl/gen/epilogue.jl, it is a really nice work you did there.
By commenting all include
s and uncommenting then one by one in ArchGDAL/test/runtests.jl and running Pkg.test("ArchGDAL"), here are my findings:
include("test_gdalutilities.jl")
: that's where the GDAL error is written to stderr "CPLDestroyMutex: Error = 16 (Resource busy)" -> I will look after itinclude("test_rasterattrtable.jl")
: produces a warning "There is no linear binning information." -> maybe it should be handledinclude("test_ospy_examples.jl")
: produces a timing output. Is it necessary to keep the @time
that must linger within ?include("test_images.jl")
: Maybe add GDAL import at the beginning instead of relying on other test filesThanks!
Ok so probably the issue is in test_gdalutilities.jl. The @time
can probably be removed, and indeed good to add a GDAL import to test_images.jl. For the warning, perhaps you can test/remove it by testing with https://docs.julialang.org/en/v1/stdlib/Test/#Test.@test_warn? Would be nice to not see it.
Ok so probably the issue is in test_gdalutilities.jl
Narrowing a bit more, it happens in tests @test_throws GDAL.GDALError ...
. Something seems to need a release
Looks like this is not in a do-block that automatically closes it, nor is it manually closed: https://github.com/yeesian/ArchGDAL.jl/blob/8f820c77c790d6166f03f17f145a4ffe474933de/test/test_gdalutilities.jl#L186
Well it also happens here with a dataset closed with a do block :
This is the same file that is opened several times. Could it be that the handle is left open at line 186 causes issues at line 6 in a subsequent run?
Ok I will move everything I can to a do block form, to see what happens.
@visr I will make a PR to share code, because the issue seems to be trickier than expected.
This is something that happens on the exit of many tests over at GeoArrays, but I see the same here in the tests: https://github.com/yeesian/ArchGDAL.jl/runs/3502488899?check_suite_focus=true#step:6:67
I'd say this is something that shouldn't happen, but I'm not sure. @visr any thoughts?