fix memory leak - #51
Conversation
|
I don't understand the purpose of this fix. I don't believe this is a memory leak. The socket is going to close and will be deleted, and with it, the queue will be deleted as well. Or am I missing something? |
|
i use tracemalloc to trace the memory used, i emit many object to socket every second, the memory used don't released when client lose the connection, and i checked the close method is called, but the objects in queue don't released , so i have to do it . |
|
Any of the "del self.sockets[sid]" sentence in engineio\server.py wasn't be called. |
Wouldn't that also cause the socket object and the queue to be leaked? You said just the items in the queue were leaked, or did I misunderstand? Can you show me how did you set up your tracemalloc test? |
|
As you said, the socket object and the queue all will be leaked. It's the new found. |
|
So then this PR is not a complete fix? There's still leaked objects? |
|
The server object don't have any chance to del the socket if client don't send the disconnect event in polling mode. |
|
That is incorrect. Any time a message is emitted to a timed out socket, the server will delete it. Is that the situation you are trying to address? I think a better solution would be to be more efficient in detecting these sockets that are abandoned, instead of waiting until they need to be used. |
|
I has add some log code, the close method in socket object has been called, but the socket object seems never be deleted in server object. |
|
Do you have a stack trace for the call to |
|
File "C:\Python34\lib\site-packages\flask_socketio_init_.py", line 346, in emit |
b06cdac to
d11b9da
Compare
|
This was fixed in a different way now. |
the items in queue doesn't release when socket close.