Bug 1134132

Summary: tcsh memory leak with source command
Product: Red Hat Enterprise Linux 6 Reporter: Angelo Bonet <angelotech>
Component: tcshAssignee: David Kaspar // Dee'Kej <deekej>
Status: CLOSED ERRATA QA Contact: Iveta Wiedermann <isenfeld>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.5CC: angelotech, dkutalek, isenfeld, ovasik, praiskup, rda
Target Milestone: rcKeywords: EasyFix
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: tcsh-6.17-31.el6 Doc Type: Bug Fix
Doc Text:
NO_DOCS
Story Points: ---
Clone Of:
: 1273513 (view as bug list) Environment:
Last Closed: 2016-05-11 00:55:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1254457, 1273513    

Description Angelo Bonet 2014-08-26 23:12:51 UTC
Description of problem:

tcsh appears to leak some memory during every invocation of its 'source' command


Version-Release number of selected component (if applicable):
tcsh-6.17-24.el6.i686
(also observed on RHEL4, RHEL5 and Fedora 20's tcsh packages)


How reproducible:
Always


Steps to Reproduce:
1. Create a script to source:
% touch noop.csh

2.Sit in a loop, continuously invoking 'source':
% while (1)
while? source noop.csh
while? end

3. Watch memory grow on the tcsh process

Actual results:
Memory growth (without any apparent limit) on the tcsh process

Expected results:
No memory growth

Additional info:
The leak appears to be rather small and would require a lot of source invocations to consume any significant amount of memory.  But this can still be an issue for long-running tcsh environments.

Comment 2 Angelo Bonet 2014-09-08 19:26:58 UTC
FYI:  

Upstream bug report:  http://bugs.gw.com/view.php?id=377

Comment 3 FridolĂ­n PokornĂ˝ 2014-09-09 09:11:24 UTC
Thanks! I was going to upload the patch, but you were faster. The upstream fix is only partial; I still get memory leaks. The problem is that variable "paraml" is overwritten and allocated memory is lost (there should be freelex() called).

To merge upstream changes, our file file locking patch has to be adjusted (tcsh-6.18.00-history-file-locking.patch).

Comment 4 David Kaspar // Dee'Kej 2015-10-19 17:47:52 UTC
This problem was already fixed by upstream in tcsh version 6.19.00. It is a simple "one-liner" fix:
https://github.com/tcsh-org/tcsh/commit/b73f3a4dbd4892bc796087022f6907b20c773f69

Extracting the patch and creating the reproducer shouldn't be any problem.

Comment 9 errata-xmlrpc 2016-05-11 00:55:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-0938.html