Copilot commented on code in PR #12658:
URL: https://github.com/apache/gluten/pull/12658#discussion_r3680383194
##########
gluten-core/src/main/scala/org/apache/gluten/component/Component.scala:
##########
@@ -47,10 +47,23 @@ trait Component {
if (!isRegistered.compareAndSet(false, true)) {
return
}
- graph.add(this)
+ try {
+ graph.add(this)
+ } catch {
+ // Nothing entered the graph, so Graph#clear will not see this component
and cannot reset
+ // its flag. Roll the flag back here to keep it in sync with the graph.
+ case t: Throwable =>
+ isRegistered.set(false)
+ throw t
+ }
Review Comment:
Catching `Throwable` here is overly broad (it also matches fatal errors like
`VirtualMachineError`). Since the intent is to roll back the registration flag
only for normal failures from `graph.add`, prefer catching
`scala.util.control.NonFatal` and rethrowing.
--
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]