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

Increasing memory usage with socket.io, node.js x64 on windows server 2008 #943

Closed
jrappswe opened this issue Jul 4, 2012 · 2 comments
Closed

Comments

@jrappswe
Copy link

jrappswe commented Jul 4, 2012

Hello,

we are running the following code in production and after a couple of days (with an average of 400 simultaneous socket connections on each front) node uses over 2.5gb of memory and increasing. Have anybody else had the same problem and does anybody know why?

process.on( 'uncaughtException', function( err ) { console.log( err ); } );
var io = require( 'socket.io' ).listen( 8080 );
function joinChannel( roomId ) {
this.join( roomId );
}
io.sockets.on( 'connection', function( socket ) {
socket.on( 'joinChannel', joinChannel );
} );
io.set( 'log level', 1 );
var http = require( 'http' );
var handlePostData = function( data ) {
var message = JSON.parse( data.toString() );
io.sockets'in'.volatile.emit( 'clientEvent', message );
};
var server = function( req, res ) {
req.addListener( 'data', handlePostData );
};
http.createServer( server ).listen( 1339 );

best regards Joakim

@wavded
Copy link

wavded commented Jul 6, 2012

make sure you leave the room you joined when you are done, if not, it caches messages when a user reconnects to give back to them, can get really big!

@jrappswe
Copy link
Author

jrappswe commented Jul 6, 2012

Thanks for the tip, I did actually rewrite the room-handling (not using join at all) before posting, just to make sure it didn't create the leak. My worries right now is that it might either be socket.io that keeps data to old connections (have profiled the socket.io object and couldn't find anything) or even worse, that v8 doesn't release unused memory in windows as it should. Today we installed a CentOS machine to see if it is a node-windows issue, I will post results from that on Monday.

This issue was closed.
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

2 participants