thswlsqls opened a new pull request, #8684:
URL: https://github.com/apache/paimon/pull/8684

   
   ### Purpose
   
   fix #8682
   
   - `NetworkClient.sendRequest()` resolved connections with a non-atomic 
check-then-act on a `ConcurrentHashMap` (`get()` -> null check -> `put()`).
   - Concurrent first requests to the same address each created a 
`ServerConnection` and called `bootstrap.connect()`; the later `put()` orphaned 
the earlier one.
   - The orphan is absent from the map, so its close-future `remove(addr, 
orphan)` is a no-op and `shutdown()` never closes it, leaking the Netty channel.
   - Replaced with an atomic `connections.computeIfAbsent(...)`, restoring the 
idiom from the Apache Flink source this file was ported from.
   
   ### Tests
   
   - Added 
`NetworkClientTest#testConcurrentFirstRequestsCreateSingleConnection`: 8 
threads race the initial connect via a `CountDownLatch`, asserting the server 
accepts exactly one channel and `stats.getNumConnections() == 0` after shutdown.
   - `mvn -pl 
paimon-service/paimon-service-client,paimon-service/paimon-service-runtime 
clean install` — `NetworkClientTest` 6 tests passed. No ITCases.
   
   
   


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