[prev in list] [next in list] [prev in thread] [next in thread]
List: asterisk-dev
Subject: Re: [asterisk-dev] [Code Review] fix for problem when using t38 gateway, one of two fax sessions of
From: "Mark Michelson" <reviewboard () asterisk ! org>
Date: 2012-11-26 23:14:52
Message-ID: 20121126231452.27493.38410 () hotblack ! digium ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2205/#review7439
-----------------------------------------------------------
This is not the correct fix.
Since "fax show sessions" is showing two duplicate sessions, it means that =
somehow fax_session_new() is being called twice for the same session. This =
results in the session being added to the container twice. Your fix ensures=
that duplicate fax sessions cannot be added to the container, but it does =
not fix other memory leaks that are present. For instance, a fax_session's =
channame, debug_info, and chan_uniqueid fields will be overwritten without =
first being freed if fax_session_new() is called with the same fax session =
more than once. =
In order to fix this properly, you first need to determine why fax_session_=
new() is being called more than once for the same fax session. From there, =
there are two possible fixes:
1) Being able to call fax_session_new() on the same fax session more than o=
nce is an error. If it is, then prevent the scenario from happening in the =
first place.
2) If calling fax_session_new() on the same fax session more than once is a=
ctually the correct thing to do, then fax_session_new() needs to be modifie=
d to get rid of any possible memory leaks, not just the duplicate container=
entries.
- Mark
On Nov. 21, 2012, 7:57 p.m., schmidts wrote:
> =
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2205/
> -----------------------------------------------------------
> =
> (Updated Nov. 21, 2012, 7:57 p.m.)
> =
> =
> Review request for Asterisk Developers.
> =
> =
> Summary
> -------
> =
> I have noticed when using t38 gateway function i allways have one stuck f=
ax session of two sessions for each call in "fax show sessions" when the ga=
teway is used.
> =
> by digging into code i have found that the original session object is lin=
ked into the faxregistry.container but then will be reused. this stuck sess=
ion wasnt a real object cause it was used on the second session but it was =
still hanging around in the container.
> =
> =
> Diffs
> -----
> =
> branches/10/res/res_fax.c 376583 =
> =
> Diff: https://reviewboard.asterisk.org/r/2205/diff
> =
> =
> Testing
> -------
> =
> t38 gateway tested by sending several fax from an asterisk 1.2 with hylaf=
ax and got t38 on the other side. Fax sessions are empty when the call is f=
inished and also only one session is shown during a call.
> =
> =
> Thanks,
> =
> schmidts
> =
>
[Attachment #5 (text/html)]
<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;"> <tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/2205/">https://reviewboard.asterisk.org/r/2205/</a>
</td>
</tr>
</table>
<br />
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: \
-pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">This is not the correct \
fix.
Since "fax show sessions" is showing two duplicate sessions, it means that \
somehow fax_session_new() is being called twice for the same session. This results in \
the session being added to the container twice. Your fix ensures that duplicate fax \
sessions cannot be added to the container, but it does not fix other memory leaks \
that are present. For instance, a fax_session's channame, debug_info, and \
chan_uniqueid fields will be overwritten without first being freed if \
fax_session_new() is called with the same fax session more than once.
In order to fix this properly, you first need to determine why fax_session_new() is \
being called more than once for the same fax session. From there, there are two \
possible fixes: 1) Being able to call fax_session_new() on the same fax session more \
than once is an error. If it is, then prevent the scenario from happening in the \
first place. 2) If calling fax_session_new() on the same fax session more than once \
is actually the correct thing to do, then fax_session_new() needs to be modified to \
get rid of any possible memory leaks, not just the duplicate container entries.</pre> \
<br />
<p>- Mark</p>
<br />
<p>On November 21st, 2012, 7:57 p.m., schmidts wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('https://reviewboard.asterisk.org/media/rb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;"> <tr>
<td>
<div>Review request for Asterisk Developers.</div>
<div>By schmidts.</div>
<p style="color: grey;"><i>Updated Nov. 21, 2012, 7:57 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">I have noticed when using t38 gateway function i allways have one stuck \
fax session of two sessions for each call in "fax show sessions" when the \
gateway is used.
by digging into code i have found that the original session object is linked into the \
faxregistry.container but then will be reused. this stuck session wasnt a real object \
cause it was used on the second session but it was still hanging around in the \
container.</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0"> <tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">t38 gateway tested by sending several fax from an asterisk 1.2 with \
hylafax and got t38 on the other side. Fax sessions are empty when the call is \
finished and also only one session is shown during a call.</pre> </td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>branches/10/res/res_fax.c <span style="color: grey">(376583)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/2205/diff/" style="margin-left: \
3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic