client leak Half-closes sockets
See original GitHub issuein client with node v10.19.0, each time client.unbind()
is called or on errors, the socket isn’t destroyed only socket.end()
is called and leak an Half-closes socket.
# lsof | grep "can't identify protocol"
node 25454 root 23u sock 0,6 0t0 773832799 can't identify protocol
node 25454 root 24u sock 0,6 0t0 773840655 can't identify protocol
node 25456 root 23u sock 0,6 0t0 773831258 can't identify protocol
node 25456 root 24u sock 0,6 0t0 773831259 can't identify protocol
node 25456 root 25u sock 0,6 0t0 773831938 can't identify protocol
node 25456 root 26u sock 0,6 0t0 773831939 can't identify protocol
node 25456 root 27u sock 0,6 0t0 773832361 can't identify protocol
node 25456 root 28u sock 0,6 0t0 773832362 can't identify protocol
node 25456 root 29u sock 0,6 0t0 773832913 can't identify protocol
node 25456 root 30u sock 0,6 0t0 773832914 can't identify protocol
node 25456 root 31u sock 0,6 0t0 773834034 can't identify protocol
after some time, node can’t open any file and return error EMFILE: too many open files, open
replace socket.end() by socket.destroy() in lines: https://github.com/ldapjs/node-ldapjs/blob/master/lib/client/client.js#L1096 https://github.com/ldapjs/node-ldapjs/blob/master/lib/client/client.js#L1163 https://github.com/ldapjs/node-ldapjs/blob/master/lib/client/client.js#L1177 https://github.com/ldapjs/node-ldapjs/blob/master/lib/client/client.js#L1454 solved the problem
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Both sides of a TCP connection are closed when the client or ...
The client or the remote application server half-closes the TCP connection ... When traffic is passed through a user-mode data flow, both sockets...
Read more >4.7. The Mysteries of Connection Close - HTTP - O'Reilly
Full and half closes. An application can close either or both of the TCP input and output channels. A close( ) sockets call...
Read more >c++ - Sockets in Linux - how do I know the client has finished ...
I basically open a socket, listen, wait for a connection and open a new socket from which I read the data sent by...
Read more >Net | Node.js v19.3.0 Documentation
createServer() ) and clients ( net.createConnection() ). ... Server , so the user can use it to interact with the client. ... Half-closes...
Read more >TCP and UDP Socket API - W3C
This API provides interfaces to raw UDP sockets, TCP Client sockets and TCP Server ... halfClose(); // Log result of TCP connection attempt....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We’re also seeing this behavior. ldapjs-1.0.2 On node 12.13.1
Note I cannot reproduce this on my local MacOS environment. We only see it in our dockerized production environments.
We are connecting via secure (ldaps) to an Active Directory server.
Very likely. It would take some research into how the socket is being leaked so that it can be reaped correctly.