wForget opened a new issue, #2810: URL: https://github.com/apache/uniffle/issues/2810
### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) ### Search before asking - [x] I have searched in the [issues](https://github.com/apache/incubator-uniffle/issues?q=is%3Aissue) and found no similar issues. ### Describe the bug ### Summary `DecompressionWorker` allocates a destination buffer (`dst`) before decompressing each shuffle block. When decompression throws an exception, the allocated direct buffer is not explicitly released, leaving reclamation to JVM cleanup. Under persistent decompression failures, this may cause delayed direct-memory reclamation and excessive memory usage, potentially contributing to executors being killed by YARN. ### Environment - Spark: `3.5.0` - Uniffle: `0.10.100-f85be53c` - Deployment: YARN ```properties spark.executor.memory=8g spark.executor.memoryOverhead=4096 spark.executor.cores=4 spark.rss.client.read.overlappingDecompressionEnable=true spark.rss.client.read.prefetch.enabled=true ``` ### Suspected problematic code In `DecompressionWorker.add()`: ```java ByteBuffer dst = buffer.isDirect() ? ByteBuffer.allocateDirect(uncompressedLen) : ByteBuffer.allocate(uncompressedLen); codec.decompress(buffer, uncompressedLen, dst, 0); ``` If `codec.decompress()` throws, execution reaches the future’s exception handler: ```java .exceptionally( ex -> { LOG.error("Errors on decompressing shuffle block", ex); return null; }); ``` The handler logs the exception and returns `null`, but does not explicitly release the already allocated `dst` buffer. Additionally, memory accounting is updated only after successful decompression, so failed allocations are not reflected in the worker’s memory statistics. ### Observed evidence A Spark SQL workload without identified data skew or data expansion repeatedly failed on the same task across different executors. Three attempts were killed for exceeding the **12 GiB container memory limit**, despite a **4 GiB memory overhead allocation**. Another attempt was killed for exceeding the container log directory limit. For the final attempt: - **261,449 decompression errors** were logged between `2026-10-09 23:40:53` and `2026-10-10 00:01:07` (`UTC+08:00`). - YARN reported physical memory usage of **12.1 GB / 12 GB**. Repeated exceptions included: ```text ERROR DecompressionWorker: Errors on decompressing shuffle block com.github.luben.zstd.ZstdException: Unknown frame descriptor com.github.luben.zstd.ZstdException: Data corruption detected at org.apache.uniffle.common.compression.ZstdCodec.decompress(ZstdCodec.java:53) at org.apache.uniffle.client.impl.DecompressionWorker.lambda$add$0(DecompressionWorker.java:131) ``` These observations do not prove a permanent native-memory leak. The failed destination buffers may eventually be reclaimed by the JVM, and heap growth was also observed. However, the failure path appears to lack timely, explicit cleanup. ### Affects Version(s) master ### Uniffle Server Log Output ```logtalk ``` ### Uniffle Engine Log Output ```logtalk ``` ### Uniffle Server Configurations ```yaml ``` ### Uniffle Engine Configurations ```yaml ``` ### Additional context _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
