[asterisk-dev] Asterisk Leaks FileDescriptor in handle_recordfile - if Call Disconnect happens while playing beep

Matthew Jordan mjordan at digium.com
Fri May 23 12:23:36 CDT 2014


On Fri, May 23, 2014 at 12:09 PM, bala murugan <fightwithme at gmail.com> wrote:
> Thanks Matt,
>
>    I think I found what is going wrong , but Before that I want to confirm
> and Can you please verify what I am doing below is correct -
>
> During Record using agi handle_recordfile and When there is a disconnect
> while in ast_waitstream , I can see the ast_closestream is initiated only
> channel.c during call cleanup
> to close the stream opened for beep .
>
> can I call the ast_closestream in agi handle_recordfile itself if I get
> return response as -1 to close the filestream opened for beep, I hope this
> shouldn't affect the flow
>

You shouldn't need to explicitly close the stream. If the channel
hangs up during ast_waitstream, then ast_hangup will already clean up
the file stream for you. Calling ast_closestream at that point is at
best a NoOp - but since the filestream has already been closed and its
ref count decremented, you may cause a reference count imbalance.

So, no, you shouldn't call ast_closestream explicitly.

Why do you think the FD is being leaked when the channel hangs up
during playback of beep? Have you compiled with DEBUG_FD_LEAKS and
verified that the FD is being leaked?

-- 
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org



More information about the asterisk-dev mailing list