Tracing a Memory-leak in a Long Running Eventmachine Application

Post on 30-Jun-2015

141 views 2 download

description

Slide: In Huanteng Smart we manufacture smart household gadgets which all connect to a single long running eventmachine application to receive and send instructions with the server. This eventmachine application is a single Linux process holding all TCP connections never closes them. One day, we found that this process was leaking memory, and here is how we managed to trace its cause.

transcript

����������������������������������������������������������������

����������������������������������������������������������������

�������

����

��������������������������������������������������������

�������������������

���������

���������

�������������������

�������������������������������������������������������������������������������反�堆模式�

����������������������������������������������������������������������������������������������

���������������������������������������������������������

��������������������������������������������������������

���������������������������

��������������������������������������

��������������������������������������������������������������������������������������������������������������������������������������������������

�����������������������

�������������������������������������������������������������

��������������������������������

�������������������������������

���������������������������������������������������������

������������������������������������������

����������������������������������������������������

�������������������

������ �������������������������

������� ���

����� ���

�� ���

����� ����

����� ����

��� �����

�������������������

���������������

�������������������������������

����������������������������

�������������������

�������������������������������������������������

����������������������������������������������������������������������������

����������������������������������������������������

�����������������������������������

���������������������������������������������

�������������������������������������������������������������������个开����������功能���������������������������������������������������������������������探��包���隔����没有数据通�后,�送第⼀个���������包,注意有些�⾔中�位是毫秒����������������������������������������������������������������������此后每����送⼀个���������包,注意有些�⾔中�位是毫秒�������������������������������������������������������������������当���个���������包没收到的�候,断开�接������

����������������������������

�������������������������������������

�������������������

�������������������

����������������������������������������������������������������������������������������������������������������������������������������������������������������������

�������������������

������������������������������������������������������������

���

�������������������������������������������������������������������������������������������������������������������������������������������������������������

��������������������������������������

��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

���������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

���������������������������������������

�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

�������������������������������������

������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

�������������������������������������

�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������

����������������������������

�����������������������������������������������������

��������������������

�������������������������������������

�������������������

���������������������������������

������������������������������������������������������������������������������

���������������������������������������������������

�������������������

�������������������

�������������������

�������������������

�������������������

���������������������������������������������

�������������������������������������

�������������������

������������������

����������������������������������������������������������������������

����������������������������������������������������������������������

���������������������������������������������������������������������������������������������

�������������������

���������������������������������������������������������������

��������������������������

�����������������������������������

������������������������������������������

�������������������

�����������������

�������������������

�����������

����������������������������������������� ������������������������������������������������������������������������������������������������������������ ��������� ������������ ���������������

�������������������

������������������������

����������������������������������������

�����������������������������������������������������������

����������������������������������������������������������

�������������������

�����������������������������������������

�����������������������

�����������

����

���

�������������������

������������������������������������������������

��������������������������������������������������������������

���������

�����������������������������������������

���������������������������

��������������������������

�����������������