DanielLeens opened a new pull request, #12444:
URL: https://github.com/apache/seatunnel/pull/12444

   ### Purpose of this pull request
   
   `PayPalClientTest#closeWakesRetryWait` keeps failing on the `unit-test (11, 
windows-latest)` / `(8, windows-latest)` jobs of PRs that do not touch the 
PayPal connector, most recently on #11814 (2026-09-22) and #11215 (2026-09-18), 
always at the same assertion:
   
   ```
   PayPalClientTest.closeWakesRetryWait:416 expected: <true> but was: <false>
   ```
   
   That line is the first `arrived.await(NETWORK_WAIT_SECONDS, ...)`, i.e. the 
test gives up waiting for the request to reach the embedded server. #12370 
widened that wait from 3 s to 15 s and the failure came back at the same line, 
and the open #12381 proposes widening it again to 60 s. The wait budget is not 
the problem: the latch is never counted down.
   
   ### Root cause
   
   `serve()` in the test counts `arrived` down only after it has written the 
reply body:
   
   ```java
   exchange.getResponseBody().write(reply.body);
   arrived.countDown();
   ```
   
   `closeWakesRetryWait` replies `503 {}`. `PayPalClient#execute` does not read 
the body of a transient status: it returns as soon as it has the status line, 
and its `finally` block calls `request.abort()`, which closes the socket. On 
Linux the server's 2-byte write still lands in the send buffer, so the 
countDown runs. On Windows a write into a socket the peer has already closed 
fails with an `IOException`; `serve()` swallows it in `catch (IOException 
ignored)` and never reaches the countDown, so the test waits out the whole 
budget for a request that arrived long ago. Whether the client's abort or the 
server's write wins is scheduling-dependent, which is why the failure is 
intermittent and only seen on the Windows legs.
   
   ### Fix (test-only)
   
   - Count `arrived` down before the body write for plain replies, so the 
client aborting the connection cannot skip it.
   - Also count it down in the `finally` block, so no response-side failure can 
leave a test waiting on the latch. The latch is a `CountDownLatch(1)`, so the 
second call is a no-op on the normal path.
   - The `bodyless` and blocking branches keep their existing order: 
`closeAbortsActiveBody` relies on the first body byte having been flushed when 
the latch is released.
   
   No assertion, expected value or wait budget changes. Compared with #12381 
this removes the cause instead of widening the wait, which cannot help when the 
countDown is skipped.
   
   ### Files
   
   - 
`seatunnel-connectors-v2/connector-http/connector-http-paypal/src/test/java/org/apache/seatunnel/connectors/seatunnel/paypal/source/PayPalClientTest.java`
   
   ### How was this patch tested?
   
   Test-helper-only change, verified by this PR's GitHub CI (`unit-test` on all 
four matrix legs) per this initiative's no-local-build policy. Local checks 
were limited to `./mvnw spotless:apply -pl 
seatunnel-connectors-v2/connector-http/connector-http-paypal`.
   
   ### Check list
   
   * [x] No new Jar binary package is added.
   * [x] Documentation is not required.
   * [x] `incompatible-changes.md` is not required.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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

Reply via email to