thswlsqls opened a new issue, #8682:
URL: https://github.com/apache/paimon/issues/8682

   **Search before asking**
   - [x] I searched in the [issues](https://github.com/apache/paimon/issues) 
and found nothing similar.
   
   **Paimon version**
   master @ b7df2b487 / 2.0-SNAPSHOT
   
   **Compute Engine**
   Engine-agnostic (paimon-service, shared by Flink/Spark lookup join)
   
   **Minimal reproduce step**
   `NetworkClient.sendRequest()` 
(paimon-service/paimon-service-client/.../network/NetworkClient.java, lines 
146-162) resolves connections with a non-atomic check-then-act on a 
`ConcurrentHashMap`: `connections.get()` -> null check -> `connections.put()`. 
When two threads issue the first request to the same server address 
concurrently, both pass the null check and each creates a `ServerConnection` 
and calls `bootstrap.connect()`. The later `put()` overwrites the earlier 
connection in the map.
   
   **What doesn't meet your expectations?**
   Expected: exactly one connection per server address. Actual: the orphaned 
connection is never referenced by the map, so its close-future handler 
`connections.remove(addr, orphan)` is a no-op and `shutdown()` (which iterates 
the map) never closes it. Its Netty channel leaks and `stats` never reports the 
connection inactive, so `numConnections` stays above zero.
   
   **Anything else?**
   The upstream this file was ported from (Apache Flink 
`queryablestate.network.Client.sendRequest`) uses 
`connections.computeIfAbsent(...)`, which is atomic. The fix restores that 
idiom.
   
   **Are you willing to submit a PR?**
   - [x] I'm willing to submit a PR!
   
   


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