Package: bash
Version: 4.4-1
Severity: serious

Hello,

apparently bash 4.4 as available in Debian Stretch introduced a
regression compared to 4.3 from Debian Jessie: when setting $HISTSIZE to
a big value (e.g. 99999999 as suggested in a lot of docs out there on
the web), the resulting bash process seems to allocate way to much
memory, approximately 800MB each.

I consider this a severe memory leak/consumption bug, thus setting
severity to serious. Feel free to lower severity if you disagree.

It's not enough to set the environment variable $HISTSIZE in a running
bash session. Instead, it needs to set at invocation of the shell, e.g.
by setting it in the ~/.bashrc:

HISTSIZE=99999999

Here's the process status page of a process with HISTSIZE=99999999:

$ cat /proc/3156/status
Name:   bash
Umask:  0022
State:  S (sleeping)
Tgid:   3156
Ngid:   0
Pid:    3156
PPid:   2796
TracerPid:      0
Uid:    1000    1000    1000    1000
Gid:    1000    1000    1000    1000
FDSize: 256
Groups: 24 25 27 29 30 44 46 107 111 123 125 126 127 1000 
NStgid: 3156
NSpid:  3156
NSpgid: 3156
NSsid:  3156
VmPeak:  1071904 kB
VmSize:  1071868 kB
VmLck:         0 kB
VmPin:         0 kB
VmHWM:    787328 kB
VmRSS:    787328 kB
RssAnon:          783640 kB
RssFile:            3688 kB
RssShmem:              0 kB
VmData:  1050920 kB
VmStk:       136 kB
VmExe:      1024 kB
VmLib:      2116 kB
VmPTE:      1600 kB
VmPMD:        16 kB
VmSwap:        0 kB
HugetlbPages:          0 kB
Threads:        1
SigQ:   0/45722
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000010000
SigIgn: 0000000000380004
SigCgt: 000000004b817efb
CapInh: 0000000000000000
CapPrm: 0000000000000000
CapEff: 0000000000000000
CapBnd: 0000003fffffffff
CapAmb: 0000000000000000
Seccomp:        0
Cpus_allowed:   ff
Cpus_allowed_list:      0-7
Mems_allowed:   00000000,00000001
Mems_allowed_list:      0
voluntary_ctxt_switches:        30
nonvoluntary_ctxt_switches:     13

And here you find the status page of a bash process with default
HISTSIZE=1000:

$ cat /proc/6888/status
Name:   bash
Umask:  0022
State:  S (sleeping)
Tgid:   6888
Ngid:   0
Pid:    6888
PPid:   2796
TracerPid:      0
Uid:    1000    1000    1000    1000
Gid:    1000    1000    1000    1000
FDSize: 256
Groups: 24 25 27 29 30 44 46 107 111 123 125 126 127 1000 
NStgid: 6888
NSpid:  6888
NSpgid: 6888
NSsid:  6888
VmPeak:    23220 kB
VmSize:    23156 kB
VmLck:         0 kB
VmPin:         0 kB
VmHWM:      6028 kB
VmRSS:      6028 kB
RssAnon:            2248 kB
RssFile:            3780 kB
RssShmem:              0 kB
VmData:     2208 kB
VmStk:       136 kB
VmExe:      1024 kB
VmLib:      2116 kB
VmPTE:        64 kB
VmPMD:        12 kB
VmSwap:        0 kB
HugetlbPages:          0 kB
Threads:        1
SigQ:   0/45722
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000010000
SigIgn: 0000000000380004
SigCgt: 000000004b817efb
CapInh: 0000000000000000
CapPrm: 0000000000000000
CapEff: 0000000000000000
CapBnd: 0000003fffffffff
CapAmb: 0000000000000000
Seccomp:        0
Cpus_allowed:   ff
Cpus_allowed_list:      0-7
Mems_allowed:   00000000,00000001
Mems_allowed_list:      0
voluntary_ctxt_switches:        57
nonvoluntary_ctxt_switches:     7

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 4.7.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_US.UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages bash depends on:
ii  base-files   9.6
ii  dash         0.5.8-2.3
ii  debianutils  4.8
ii  libc6        2.24-5
ii  libtinfo5    6.0+20160917-1

Versions of packages bash recommends:
ii  bash-completion  1:2.1-4.3

Versions of packages bash suggests:
pn  bash-doc  <none>

-- no debconf information

Reply via email to