qianlan717 opened a new pull request, #59262:
URL: https://github.com/apache/spark/pull/59262

   ### What changes were proposed in this pull request?
   
   Add a scoped `withIvyContext` helper that always pops an Ivy context in a 
`finally` block. Use it for both the primary Maven resolution and the no-cache 
fallback resolution.
   
   Add regression tests for failures in both resolution paths and verify that 
the original Ivy context is restored. The primary-path test also verifies that 
a subsequent resolution on the same thread succeeds.
   
   ### Why are the changes needed?
   
   The existing `popContext()` calls only run on successful paths. Exceptions 
from resolve or retrieve can leave Ivy's thread-local context stack unbalanced, 
allowing a later Maven resolution on the same thread to inherit stale Ivy state 
or settings.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. A Maven resolution failure no longer leaves stale Ivy context state 
that can affect a later resolution on the same thread.
   
   ### How was this patch tested?
   
   Added regression coverage to `MavenUtilsSuite` for primary and no-cache 
fallback failures.
   
   Ran:
   
   ```
   build/sbt 'common-utils/testOnly *MavenUtilsSuite'
   build/sbt 'common-utils/scalastyle' 'common-utils/Test/scalastyle'
   ```
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: OpenAI Codex (GPT-5)
   


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