Bug 13372 - vfswrap_getwd() leaks memory.
Summary: vfswrap_getwd() leaks memory.
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
Depends on:
Reported: 2018-04-06 20:50 UTC by Jeremy Allison
Modified: 2018-04-12 06:54 UTC (History)
3 users (show)

See Also:

git-am fix for master. (1.24 KB, patch)
2018-04-06 20:52 UTC, Jeremy Allison
no flags Details
git-am fix for master. (848 bytes, patch)
2018-04-06 20:56 UTC, Jeremy Allison
no flags Details
git-am fix for master. (1.03 KB, patch)
2018-04-06 23:04 UTC, Jeremy Allison
no flags Details
git-am fix for 4.7.next, 4.8.next. (1.27 KB, patch)
2018-04-09 21:12 UTC, Jeremy Allison
slow: review+

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Allison 2018-04-06 20:50:04 UTC

Comment 1 Jeremy Allison 2018-04-06 20:52:48 UTC
Created attachment 14108 [details]
git-am fix for master.

On Fri, Apr 06, 2018 at 04:40:44PM -0400, Andrew Walker via samba-technical wrote:
> Hi all,
> I encountered an issue where several FreeNAS users on samba 4.7 were
> experiencing memory leak resulting in single smbd process consuming all
> available RAM and swap space. Disabling the getwd cache significantly
> increased rate of leak, and enabling widelinks / disabling unix extensions
> made the leak apparently stop. Investigation indicated that the leak was in
> vfswrap_getwd().
> The attached patch resolved the issue.
Comment 2 Jeremy Allison 2018-04-06 20:56:58 UTC
Created attachment 14109 [details]
git-am fix for master.

I think this one is a simpler change.
Comment 3 Jeremy Allison 2018-04-06 23:04:41 UTC
Created attachment 14112 [details]
git-am fix for master.

Confirmed fixed by submitter.
Comment 4 Timur Bakeyev 2018-04-06 23:11:40 UTC
(In reply to Jeremy Allison from comment #3)

Should we put similar warning to the `vfswrap_realpath` then, as `sys_realpath()` suffered from exactly the same problem?
Comment 5 Jeremy Allison 2018-04-06 23:18:25 UTC
No, only change the function that needed addressing. If we refactor later we can add this.
Comment 6 Andrew Walker 2018-04-08 11:15:09 UTC
Quick confirmation that your patch fixes the issue I was seeing. Thanks for your prompt response. Next time I will generate a corresponding bug report.
Comment 7 Jeremy Allison 2018-04-09 21:12:47 UTC
Created attachment 14115 [details]
git-am fix for 4.7.next, 4.8.next.

Cherry-picked from master. Applies cleanly to 4.7.next, 4.8.next.
Comment 8 Ralph Böhme 2018-04-10 06:03:01 UTC
Reassigning to Karolin for inclusion in 4.7 and 4.8.
Comment 9 Karolin Seeger 2018-04-10 07:39:24 UTC
Pushed to autobuild-v4-[7,8]-test.
Comment 10 Karolin Seeger 2018-04-12 06:54:47 UTC
(In reply to Karolin Seeger from comment #9)
Pushed to both branches.
Closing out bug report.