LuciferYang opened a new pull request, #13166: URL: https://github.com/apache/gluten/pull/13166
## What changes are proposed in this pull request? The task-completion listener in `TaskResources` held the JVM-global `RESOURCE_REGISTRIES` monitor across `TaskResourceRegistry.releaseAll()` and the peak-memory metric update. On a real executor those release callbacks include native (JNI) teardown that can take milliseconds, so while one finishing task runs them, every other task's completion and registration blocks on the same global monitor. This moves `releaseAll()` and the metric update outside that lock. The global monitor now only guards the map: it is taken briefly to fetch the registry, and again at the end to remove the entry (guarded so it removes only the registry it actually released). Each `TaskResourceRegistry` already has its own internal lock, so the per-task release work does not need the global one. Removal still runs in a `finally`, so the entry is dropped even if `releaseAll()` or the metric update throws, and the metric update stays best-effort so it cannot mask a release failure. ## How was this patch tested? Added `TaskResourceSuite."Run unsafe - release callbacks run outside the global registry lock"`, which starts a second task from inside a release callback and asserts it is not blocked by that callback. It fails if the release pass runs under the global lock. ## Was this patch authored or co-authored using generative AI tooling? Yes. Generated-by: Claude Opus. -- 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]
