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 #136

Closed
topiman opened this issue Jul 25, 2014 · 25 comments
Closed

memory leak #136

topiman opened this issue Jul 25, 2014 · 25 comments

Comments

@topiman
Copy link

topiman commented Jul 25, 2014

i use netty-socketio 1.6.5 .
i found a memory leak ,com.corundumstudio.socketio.transport.XHRPollingClient has not be GC.
i use Eclipse Memory Analyzer ,the description is:
One instance of "com.corundumstudio.socketio.transport.XHRPollingClient" loaded by "sun.misc.Launcher$AppClassLoader @ 0x7000b7678" occupies 342,686,224 (59.63%) bytes.
image

@mrniko
Copy link
Owner

mrniko commented Jul 25, 2014

Could you send me a memory dump?

@topiman
Copy link
Author

topiman commented Jul 25, 2014

the memory dump has private message,so I'm afraid I can't give you .
I found this
image

is it can help you ?

@topiman
Copy link
Author

topiman commented Jul 25, 2014

and this:
image

@mrniko
Copy link
Owner

mrniko commented Jul 25, 2014

XHRPollingClient contains an packet queue. And if your sending a lot of packets per second via one client you should have a good amount of memory.

Also try to reduce Configuration.closeTimeout and Configuration.heartbeatTimeout values. Then disconnect process will occurs much faster

@topiman
Copy link
Author

topiman commented Jul 25, 2014

I just send a packet per two second. not a lot of per second .I do not know why?

ÔÚ 2014Äê7ÔÂ26ÈÕ£¬0:59£¬Nikita Koksharov notifications@github.com дµÀ£º

XHRPollingClient contains an packet queue. And if your sending a lot of packets per second via one client you should have a good amount of memory.

Also try to reduce Configuration.closeTimeout and Configuration.heartbeatTimeout values. Then disconnect process will occurs much faster

¡ª
Reply to this email directly or view it on GitHub.

@mrniko
Copy link
Owner

mrniko commented Jul 26, 2014

not a lot, you right. And the client got all the packets? If server sending a packet it polls it from queue

@topiman
Copy link
Author

topiman commented Jul 26, 2014

the client kept all the packets send before . it seems not poll the message from queue.
does the client disconnect and we can not trigger the disconnect event?
I will try to reduce Configuration.closeTimeout and Configuration.heartbeatTimeout values .

@mrniko
Copy link
Owner

mrniko commented Jul 26, 2014

As you can see XHRPollingTransport.onDisconnect is implemented

@mrniko
Copy link
Owner

mrniko commented Jul 30, 2014

have you resolved this issue?

@topiman
Copy link
Author

topiman commented Jul 30, 2014

it not works after reduce Configuration.closeTimeout and Configuration.heartbeatTimeout values.
the memory still increase.

in my code i do this:
Listeners:
private map<String,SocketIOClient > clients = new ConcurrentHashMap<String,SocketIOClient >();
@Onconnect
public void onConnect(SocketIOClient client) {
clients.put(client.getSessionId().toString(),client);
}

@OnDisconnect
public void onDisconnect(SocketIOClient client) {
clients.remove(client.getSessionId().toString());
}

and another thread send message like this:
for(SocketIoclient client:map.values()){
client.sendmessage("message");
}

@mrniko
Copy link
Owner

mrniko commented Jul 30, 2014

you could try to do follow:

  1. set logging level for "com.corundumstudio.socketio" to TRACE
  2. write a for cycle from 0 to 1000, for example, then check the logs for 'out message: ... ' strings
  3. disconnect client

Take a memory dump and check for the hanged XHRPollingClient instances or packets

@mrniko
Copy link
Owner

mrniko commented Jul 30, 2014

Also you could use SocketIOServer.getBroadcastOperations to eliminate your clients map

@topiman
Copy link
Author

topiman commented Jul 30, 2014

thank you very much!
SocketIOServer.getBroadcastOperations ,i do this before ,and i use room ,but it cost a lot of cpu.so i did another way.

@mrniko
Copy link
Owner

mrniko commented Jul 30, 2014

but it cost a lot of cpu

Which version did you used?

@topiman
Copy link
Author

topiman commented Jul 30, 2014

1.6.3 before ,now i use 1.6.5

@topiman
Copy link
Author

topiman commented Jul 30, 2014

i did like this ,client.joinRoom("") ,and i create 5 rooms , 1000 clients of one room.But this is another problem!

@mrniko
Copy link
Owner

mrniko commented Jul 30, 2014

in 1.6.5 rooms handling was optimized

@mrniko
Copy link
Owner

mrniko commented Aug 9, 2014

Any progress?

@topiman
Copy link
Author

topiman commented Aug 9, 2014

i check the packages of all queue,if the count of package more than 100,i would remove the client. it seems work.

ÔÚ 2014Äê8ÔÂ9ÈÕ£¬20:58£¬Nikita Koksharov notifications@github.com дµÀ£º

Any progress?

¡ª
Reply to this email directly or view it on GitHub.

@mrniko
Copy link
Owner

mrniko commented Aug 9, 2014

Please try the latest version from master, a problem with packets decoding been there. May be it helps

@topiman
Copy link
Author

topiman commented Aug 9, 2014

thank you very much! i will have a try.

ÔÚ 2014Äê8ÔÂ9ÈÕ£¬21:54£¬Nikita Koksharov notifications@github.com дµÀ£º

Please try the latest version from master, a problem with packets decoding been there. May be it helps

¡ª
Reply to this email directly or view it on GitHub.

@mrniko
Copy link
Owner

mrniko commented Aug 9, 2014

oh, sorry! this change made for 1.7 version

@mrniko
Copy link
Owner

mrniko commented Aug 20, 2014

i check the packages of all queue,if the count of package more than 100,i would remove the client. it > seems work.

@topiman so you did a some kind of patch? Could you send me a diff if so?

@topiman
Copy link
Author

topiman commented Aug 26, 2014

i check the packages of all queue,if the count of package more than 100,i clear the xhr queue , and call onDisconnect method ,but it not works . it still has the problem.

@mrniko
Copy link
Owner

mrniko commented Aug 26, 2014

Could you write some kind of test to reproduce it?

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