I am making an handmade HTTP Proxy with NodeJS, but when there are many requests per seconds net.js is entering in an infinite loop while reading end of null connection. (it happens to random way around 40 req/s).
I separated the code that caused the bug creating a simple HTTP Proxy throwing the problem :
The code : https://gist.github.com/Ifnot/5336823
I put net.js to debug mode using command "NODE_DEBUG=net node main.js" and even when all connections seems to be closed the program output this indefinitely :
The debug : https://gist.github.com/Ifnot/5274181
NOTE : When the loop begin i can see this error :
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at Socket.EventEmitter.addListener (events.js:160:15)
at Socket.Readable.on (_stream_readable.js:653:33)
at Socket.EventEmitter.once (events.js:179:8)
at TCP.onread (net.js:527:26)
Am I doing something wrong ? Anyone know what happens ? Why this problem appear ?
(I am using node v0.10.4, problem was seen in previous version v0.9.x)