Copilot commented on code in PR #13107:
URL: https://github.com/apache/gluten/pull/13107#discussion_r4110048130
##########
gluten-core/src/main/scala/org/apache/spark/task/TaskResources.scala:
##########
@@ -290,12 +299,48 @@ class TaskResourceRegistry extends Logging {
/** Release all managed resources according to priority and reversed order */
private[task] def releaseAll(): Unit = lock {
+ val failures = mutable.ArrayBuffer.empty[Throwable]
+ def safeResourceName(resource: TaskResource): String =
+ try resource.resourceName()
+ catch {
+ // resourceName() is user code too, so a failure building the log label
+ // must not abort the loop either.
+ case NonFatal(_) => s"resource@${System.identityHashCode(resource)}"
+ }
Review Comment:
`safeResourceName` is invoked from the release-failure handler, so an
`Error` (or other `Throwable` outside `NonFatal`) from user-defined
`resourceName()` still escapes this handler before the remaining resources and
map-clearing code run. Catch `Throwable` for this best-effort label lookup and
use the identity-hash fallback, leaving fatal throwables from `release()`
itself to propagate as intended.
--
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]