I think its because of the probe. I see that the probe function you have used is after the pgie. But we need to use this probe after the tracker if i understand the issue correctly in your case.
And in case of the freezing, i think its because you have not iterated the frame as :
try:
l_frame = l_frame.next
except StopIteration:
break
So once you go inside the probe, the logic was able to go in the first frame and couldnt iterate over the other frames.