Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fix a memory leak in the
perl
module that can accumulate OSmalloc
'd memory over time. The leak is fairly slow, so unless your configuration makes very heavy use of perl functions, it may go unnoticed for quite a while, but it can eventually result in OS memory exhaustion and the OOM-killer.Details
perl_exec_simple
has a memory leak becausecall_argv
doesn't garbage-collect its arguments properly. This is technically a Perl bug, and is tracked here: Perl/perl5#22255 But, until it is fixed in Perl, we should work around the issue from the OpenSIPS side.See #3402 for more details on how to reproduce the bug in OpenSIPS and how to validate the fix.
Solution
This PR fixes the problem by applying the appropriate Perl garbage-collection context markers around the function call so that garbage collection of the arguments happens as control returns to the caller.
Compatibility
No functional change to OpenSIPS.
Closing issues
closes #3402