Qianlan Chen created SPARK-60013:
------------------------------------

             Summary: Ensure Ivy contexts are popped after Maven resolution 
failures
                 Key: SPARK-60013
                 URL: https://issues.apache.org/jira/browse/SPARK-60013
             Project: Spark
          Issue Type: Bug
          Components: Connect
    Affects Versions: 4.4.0
            Reporter: Qianlan Chen


  \{{MavenUtils.resolveMavenCoordinatesWithCancellation}} creates a primary Ivy 
instance and may create
  a second no-cache Ivy instance for fallback resolution.

  Both paths call \{{Ivy.pushContext()}}, but the corresponding 
\{{popContext()}} calls currently occur
  only on successful paths. Exceptions from resolve, retrieve, or cancellation 
can bypass cleanup and
  leave thread-local Ivy context state behind.

  If the thread is reused, a later Maven resolution may observe stale Ivy state 
or settings.

  h2. Proposed change

  Pair every \{{Ivy.pushContext()}} with \{{popContext()}} in a \{{finally}} 
block.

  A small \{{withIvyContext}} helper can wrap both the primary and no-cache 
resolution paths while
  preserving their nesting and fallback behavior.

  h2. Acceptance criteria

  * Primary Ivy context is removed after success and failure.
  * No-cache fallback context is removed after success and failure.
  * Existing retry-without-cache behavior remains unchanged.
  * Add regression tests that inject failures into both paths and verify that 
the context is restored.
  * A subsequent Maven resolution on the same thread succeeds without 
inheriting stale context.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to