EventEmitter memory leak with successful sendfile #1244

Merged
merged 1 commit into from Jul 24, 2012

Conversation

Projects
None yet
2 participants
Contributor

RubenVerborgh commented Jul 24, 2012

If sendfile is successful, the socket error listener doesn't get removed.
This leads to an EventEmitter memory leak (source: StackOverflow):

 (node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace: 
    at Socket.<anonymous> (events.js:139:15)
    at ServerResponse.sendfile (/data/www/margintop/server/node_modules/express/lib/response.js:185:14)
    at /data/www/margintop/server/webserver/webserver.js:17:9
    at callbacks (/data/www/margintop/server/node_modules/express/lib/router/index.js:165:11)
    at param (/data/www/margintop/server/node_modules/express/lib/router/index.js:139:11)
    at pass (/data/www/margintop/server/node_modules/express/lib/router/index.js:146:5)
    at Router._dispatch (/data/www/margintop/server/node_modules/express/lib/router/index.js:173:4)
    at Object.router [as handle] (/data/www/margintop/server/node_modules/express/lib/router/index.js:33:10)
    at next (/data/www/margintop/server/node_modules/express/node_modules/connect/lib/proto.js:190:15)
    at multipart (/data/www/margintop/server/node_modules/express/node_modules/connect/lib/middleware/multipart.js:52:61)

tj merged commit cb84413 into expressjs:master Jul 24, 2012

Owner

tj commented Jul 24, 2012

thanks! bad regression when switching over to visionmedia/send

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment