PDGGK opened a new pull request, #20:
URL: https://github.com/apache/iotdb-client-nodejs/pull/20

   This is the connection-leak PR (finding 6) from the dev@ discussion 
"[DISCUSS] Hardening the iotdb-client-nodejs session pool / connection 
lifecycle".
   
   ### Problem
   `Connection.open()` establishes the TCP connection (createConnection + 
createClient) and registers its 'error'/'close' listeners, then performs 
session setup (openSession, requestStatementId). If session setup rejects (bad 
credentials, a timeout, or a non-200 status), the catch only logged and rethrew 
— leaking the open socket and its listeners. Through the pool this propagates 
out of `init()` with no `close()`, so every failed connect attempt leaks one 
socket.
   
   ### Fix
   Mirror `close()`'s teardown in the catch before rethrowing: 
`removeAllListeners`, destroy/end the socket, null the refs, set `isConnected = 
false`.
   
   ### Tests
   Added a regression test asserting teardown when `openSession` fails after 
the TCP connect. Full `tests/unit` suite green (155 tests).
   


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