[10.04 LTS] emacs spins when ssh is uncleanly terminated
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GNU Emacs |
Unknown
|
Unknown
|
|||
Fedora |
Fix Released
|
Critical
|
|||
emacs23 (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Lucid |
Fix Released
|
Medium
|
Unassigned | ||
emacs23 (openSUSE) |
Fix Released
|
Medium
|
Bug Description
When emacs is running in an ssh session and ssh is terminated uncleanly, it begins to use 100% CPU and slowly but constantly increase its used memory.
[Impact]
In a department with approximately 50 desktops, one publicly accessible server, and a couple hundred users, I have to kill on average one emacs process a day. If left alone, those processes not only slow down the machine (by using up CPU time) but also eventually trigger the OOM killer when their memory usage exceeds the amount of available swap space.
Unfortunately, the Linux OOM killer is not 100% accurate at removing the cause and I have seen other long-running high-memory processes. While I have heard no complaints about data loss, it is possible.
[Development Fix]
Newer versions of Ubuntu have fixed this problem by having newer versions of emacs. The issue was fixed in 23.2a, so all Ubuntu packages > 23.2 are fixed.
[Stable Fix]
The fix from emacs applies cleanly to the source for 23.1 and can be found in their git repository: http://
[Test Case]
1) ssh to localhost
2) start emacs
3) Control-Z
4) Enter, tilde, period (to kill the SSH session)
5) emacs starts spinning and eating memory (verified by top)
[Regression Portential]
Given that the fix only affects emacs when it is exiting, it is unlikely to cause any user regressions.
Related branches
no longer affects: | lucid-backports |
description: | updated |
description: | updated |
tags: | added: patch |
Changed in emacs23 (openSUSE): | |
importance: | Unknown → Medium |
status: | Unknown → Fix Released |
summary: |
- emacs spins when ssh is uncleanly terminated + [10.04 LTS] emacs spins when ssh is uncleanly terminated |
tags: |
added: verification-done removed: verification-needed |
Changed in fedora: | |
importance: | Unknown → Critical |
status: | Unknown → Fix Released |
typically I run "emacs -nw" within xterm, and often I stop them with CTRL-Z and keep them in background.
now I've seen 2+ times that emacs loops and hogs both memory and cpu after shutting down X11 going to runlevel 3. likely this was a leftover emacs from background.
from top:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
23902 harald 20 0 7222m 3.4g 608 R 100 88.9 59:28.72 emacs-gtk
from strace:
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff1f32e320) = -1 EIO (Input/output error) PROT_WRITE, MAP_PRIVATE| MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory) PROT_WRITE, MAP_PRIVATE| MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory) PROT_WRITE, MAP_PRIVATE| MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory) MAP_ANONYMOUS| MAP_NORESERVE, -1, 0) = -1 ENOMEM (Cannot allocate memory) MAP_ANONYMOUS| MAP_NORESERVE, -1, 0) = -1 ENOMEM (Cannot allocate memory) MAP_ANONYMOUS| MAP_NORESERVE, -1, 0) = -1 ENOMEM (Cannot allocate memory) MAP_ANONYMOUS| MAP_NORESERVE, -1, 0) = -1 ENOMEM (Cannot allocate memory) PROT_WRITE, MAP_PRIVATE| MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory) PROT_WRITE, MAP_PRIVATE| MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory) SIG_BLOCK, [IO], [HUP TERM IO], 8) = 0 PROT_WRITE, MAP_PRIVATE| MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory) MAP_ANONYMOUS| MAP_NORESERVE, -1, 0) = -1 ENOMEM (Cannot allocate memory) MAP_ANONYMOUS| MAP_NORESERVE, -1, 0) = -1 ENOMEM (Cannot allocate memory) MAP_ANONYMOUS| MAP_NORESERVE, -1, 0) = -1 ENOMEM (Cannot allocate memory) MAP_ANONYMOUS| MAP_NORESERVE, -...
ioctl(3, SNDCTL_TMR_STOP or TCSETSW, {B0 -opost -isig -icanon -echo ...}) = -1 EIO (Input/output error)
write(3, "\7", 1) = -1 EIO (Input/output error)
brk(0x1bb35e000) = 0x1bb339000
mmap(NULL, 1048576, PROT_READ|
brk(0x1bb35e000) = 0x1bb339000
mmap(NULL, 1048576, PROT_READ|
brk(0x1bb35a000) = 0x1bb339000
mmap(NULL, 1048576, PROT_READ|
mmap(NULL, 134217728, PROT_NONE, MAP_PRIVATE|
mmap(NULL, 67108864, PROT_NONE, MAP_PRIVATE|
mmap(NULL, 134217728, PROT_NONE, MAP_PRIVATE|
mmap(NULL, 67108864, PROT_NONE, MAP_PRIVATE|
ioctl(3, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fff1f32e320) = -1 EIO (Input/output error)
ioctl(3, SNDCTL_TMR_STOP or TCSETSW, {B0 -opost -isig -icanon -echo ...}) = -1 EIO (Input/output error)
write(3, "\7", 1) = -1 EIO (Input/output error)
brk(0x1bb35e000) = 0x1bb339000
mmap(NULL, 1048576, PROT_READ|
brk(0x1bb35e000) = 0x1bb339000
mmap(NULL, 1048576, PROT_READ|
rt_sigprocmask(
ioctl(3, FIONREAD, [0]) = -1 EIO (Input/output error)
kill(23902, SIGHUP) = 0
brk(0x1bb35a000) = 0x1bb339000
mmap(NULL, 1048576, PROT_READ|
mmap(NULL, 134217728, PROT_NONE, MAP_PRIVATE|
mmap(NULL, 67108864, PROT_NONE, MAP_PRIVATE|
mmap(NULL, 134217728, PROT_NONE, MAP_PRIVATE|
mmap(NULL, 67108864, PROT_NONE, MAP_PRIVATE|