LuciferYang opened a new pull request, #13107:
URL: https://github.com/apache/gluten/pull/13107

   ## What changes are proposed in this pull request?
   
   `TaskResourceRegistry.releaseAll` releases resources highest-priority first 
(100 → 50 → 30), in reverse registration order. If one `release()` throws, the 
loop aborts: every remaining lower-priority resource is skipped, and 
`priorityToResourcesMapping` / `resources` are left uncleared. In practice a 
priority-100 recycler closing a native `ColumnarBatch`, or a priority-50 
shuffle reader calling `jniWrapper.stop`, can throw during task teardown, which 
then skips the priority-30 `Runtime` and leaks its native memory manager and 
threads. Across repeatedly-failing tasks on a long-lived executor this 
accumulates into an off-heap OOM.
   
   This wraps each release in its own try/catch so every resource is attempted, 
records the failures, always clears the maps, and rethrows the first failure 
(with the rest attached as suppressed) so callers still see the error. 
`resourceName()` is user code too, so it is read with a fallback that cannot 
re-abort the loop. The completion listener now clears the registry in a 
`finally`, so the maps and the `RESOURCE_REGISTRIES` entry are cleared even 
when `releaseAll` throws.
   
   ## How was this patch tested?
   
   `TaskResourceSuite` gains a case that registers a resource whose `release()` 
throws, and asserts the remaining resources are still released, the registry is 
cleared, and the failure propagates.
   
   ## Was this patch authored or co-authored using generative AI tooling?
   
   Yes. Generated-by: ZCode (GLM-5.3).
   
   Related issue: #13106.


-- 
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]

Reply via email to