Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak with socket.destroy() on 'connection' (server) #10

Open
buckle2000 opened this issue Jan 3, 2019 · 1 comment
Open

Memory leak with socket.destroy() on 'connection' (server) #10

buckle2000 opened this issue Jan 3, 2019 · 1 comment

Comments

@buckle2000
Copy link

buckle2000 commented Jan 3, 2019

Library version: v1.4.0
node: v10.14.2

Server:

const NetcatServer = require('netcat/server')
const nc = new NetcatServer().k().port(1234).listen()

nc.on('connection', socket => {
	// socket.end() // this will not cause trouble
	socket.destroy() // this will
})

Client:

# bash
timeout 0.1 nc localhost 1234
timeout 0.1 nc localhost 1234
timeout 0.1 nc localhost 1234
# do this many times

Error:

(node:21020) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 unpipe listeners added. Use emitter.setMaxListeners() to increase limit
(node:21020) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 drainlisteners added. Use emitter.setMaxListeners() to increase limit
(node:21020) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 errorlisteners added. Use emitter.setMaxListeners() to increase limit
(node:21020) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 closelisteners added. Use emitter.setMaxListeners() to increase limit
(node:21020) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 finish listeners added. Use emitter.setMaxListeners() to increase limit
@buckle2000
Copy link
Author

Stack trace showed tcpServer.js:72

    /* incoming */
    socket
      .pipe(streamDebug.call(self, debug, IPandPort))
      .pipe(self._filter, { end: !self._keepalive }) // custom filter

Honestly, I have no idea where the problem came from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant