Thanks to visit codestin.com
Credit goes to github.com

Skip to content

sig_analog: Fix channel leak when mwimonitor is enabled.#459

Merged
asterisk-org-access-app[bot] merged 1 commit into
asterisk:masterfrom
InterLinked1:master-issue-458
Nov 28, 2023
Merged

sig_analog: Fix channel leak when mwimonitor is enabled.#459
asterisk-org-access-app[bot] merged 1 commit into
asterisk:masterfrom
InterLinked1:master-issue-458

Conversation

@InterLinked1

Copy link
Copy Markdown
Contributor

When mwimonitor=yes is enabled for an FXO port,
the do_monitor thread will launch mwi_thread if it thinks there could be MWI on an FXO channel, due to the noise threshold being satisfied. This, in turns, calls
analog_ss_thread_start in sig_analog. However, unlike all other instances where __analog_ss_thread is called in sig_analog, this call path does not properly set pvt->ss_astchan to the Asterisk channel, which means that the Asterisk channel is NULL when __analog_ss_thread starts executing. As a result, the thread exits and the channel is never properly cleaned up by calling ast_hangup.

This caused issues with do_monitor on incoming calls, as it would think the channel was still owned even while receiving events, leading to an infinite barrage of warning messages; additionally, the channel would persist improperly.

To fix this, the assignment is added to the call path where it is missing (which is only used for mwi_thread). A warning message is also added since previously there was no indication that __analog_ss_thread was exiting abnormally. This resolves both the channel leak and the condition that led to the warning messages.

Resolves: #458

@InterLinked1

Copy link
Copy Markdown
Contributor Author

cherry-pick-to: 18
cherry-pick-to: 20
cherry-pick-to: 21

Comment thread channels/sig_analog.c Outdated
Comment thread channels/sig_analog.c Outdated
When mwimonitor=yes is enabled for an FXO port,
the do_monitor thread will launch mwi_thread if it thinks
there could be MWI on an FXO channel, due to the noise
threshold being satisfied. This, in turns, calls
analog_ss_thread_start in sig_analog. However, unlike
all other instances where __analog_ss_thread is called
in sig_analog, this call path does not properly set
pvt->ss_astchan to the Asterisk channel, which means
that the Asterisk channel is NULL when __analog_ss_thread
starts executing. As a result, the thread exits and the
channel is never properly cleaned up by calling ast_hangup.

This caused issues with do_monitor on incoming calls,
as it would think the channel was still owned even while
receiving events, leading to an infinite barrage of
warning messages; additionally, the channel would persist
improperly.

To fix this, the assignment is added to the call path
where it is missing (which is only used for mwi_thread).
A warning message is also added since previously there
was no indication that __analog_ss_thread was exiting
abnormally. This resolves both the channel leak and the
condition that led to the warning messages.

Resolves: asterisk#458
@gtjoseph gtjoseph added the cherry-pick-test Trigger dry run of cherry-picks label Nov 28, 2023
@github-actions github-actions Bot added cherry-pick-testing-in-progress Cherry-Pick tests in progress cherry-pick-checks-passed Cherry-Pick checks passed cherry-pick-gates-failed Cherry-Pick gates failed and removed cherry-pick-test Trigger dry run of cherry-picks cherry-pick-testing-in-progress Cherry-Pick tests in progress labels Nov 28, 2023
@github-actions

Copy link
Copy Markdown

Successfully merged to branch master and cherry-picked to ["18","20","21"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: Memory leak in chan_dahdi when mwimonitor=yes on FXO

4 participants