From 34bf471183ed3e0490799abbb9bc22306301e2f0 Mon Sep 17 00:00:00 2001 From: Mark Kittisopikul Date: Sun, 2 Jun 2024 17:52:24 -0400 Subject: [PATCH] Fix H5Zzstd error reporting and decompressed size behavior (#1151) * Fix H5Zzstd error reporting and decompressed size behavior * Remove commented out code * Use async so that callback function returns properly * Fix formatting --- filters/H5Zzstd/src/H5Zzstd.jl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/filters/H5Zzstd/src/H5Zzstd.jl b/filters/H5Zzstd/src/H5Zzstd.jl index 14bdc3fc2..e0ea75499 100644 --- a/filters/H5Zzstd/src/H5Zzstd.jl +++ b/filters/H5Zzstd/src/H5Zzstd.jl @@ -38,6 +38,9 @@ function H5Z_filter_zstd( #decompresssion decompSize = LibZstd.ZSTD_getDecompressedSize(inbuf, origSize) + if decompSize == 0 + error("zstd_h5plugin: Cannot retrieve decompressed chunk size") + end outbuf = Libc.malloc(decompSize) if outbuf == C_NULL error( @@ -83,11 +86,11 @@ function H5Z_filter_zstd( catch e # "In the case of failure, the return value is 0 (zero) and all pointer arguments are left unchanged." ret_value = Csize_t(0) - @error "H5Zzstd Non-Fatal ERROR: " err - display(stacktrace(catch_backtrace())) + # Output Julia error via async so we do not task switch during callback + @async @error "H5Zzstd Non-Fatal ERROR: " exception = (e, catch_backtrace()) finally if outbuf != C_NULL - free(outbuf) + Libc.free(outbuf) end end # try catch finally return Csize_t(ret_value)