当我使用ssh的/usr/bin/dialog时(来自windows的putty),例如:

dialog --ok-label Select --cancel-label Cancel --stdout --backtitle BACKTITLE --menu TITLE 0 50 0 '1' 'alfa' '2' 'beta'

当对话框显示时,我关闭我的油灰由ALT-F4(或鼠标点击X)对话过程不退出,但存在,并获得100%个CPU:
PID  USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
9928 user      20   0  113m 2308 1092 R 100.0  0.0   0:30.99 dialog

下面是我的GDB课程:
$ gdb -p 9928
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-56.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Attaching to process 9928
Reading symbols from /usr/bin/dialog...(no debugging symbols found)...done.
Reading symbols from /usr/lib64/libdialog.so.6...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libdialog.so.6
Reading symbols from /lib64/libncursesw.so.5...(no debugging symbols found)...done.
Loaded symbols for /lib64/libncursesw.so.5
Reading symbols from /lib64/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/libtinfo.so.5...(no debugging symbols found)...done.
Loaded symbols for /lib64/libtinfo.so.5
Reading symbols from /lib64/libdl.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /usr/lib64/gconv/ISO8859-2.so...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/gconv/ISO8859-2.so
0x00007f902081e315 in fcntl () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install dialog-1.1-9.20080819.1.el6.x86_64
(gdb) bt
#0  0x00007f902081e315 in fcntl () from /lib64/libc.so.6
#1  0x00007f9020fa3b5d in ?? () from /usr/lib64/libdialog.so.6
#2  0x00007f9020fa4230 in dlg_getc () from /usr/lib64/libdialog.so.6
#3  0x00007f9020fa15a3 in ?? () from /usr/lib64/libdialog.so.6
#4  0x00007f9020fa0668 in dlg_menu () from /usr/lib64/libdialog.so.6
#5  0x00007f9020fa131c in dialog_menu () from /usr/lib64/libdialog.so.6
#6  0x0000000000403916 in ?? ()
#7  0x000000000040415c in ?? ()
#8  0x00007f9020761cdd in __libc_start_main () from /lib64/libc.so.6
(gdb) continue
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x00007f902081de00 in __read_nocancel () from /lib64/libc.so.6
(gdb) bt
#0  0x00007f902081de00 in __read_nocancel () from /lib64/libc.so.6
#1  0x00007f9020d6a277 in _nc_wgetch () from /lib64/libncursesw.so.5
#2  0x00007f9020d7f430 in wget_wch () from /lib64/libncursesw.so.5
#3  0x00007f9020fa401f in dlg_getc () from /usr/lib64/libdialog.so.6
#4  0x00007f9020fa15a3 in ?? () from /usr/lib64/libdialog.so.6
#5  0x00007f9020fa0668 in dlg_menu () from /usr/lib64/libdialog.so.6
#6  0x00007f9020fa131c in dialog_menu () from /usr/lib64/libdialog.so.6
#7  0x0000000000403916 in ?? ()
#8  0x000000000040415c in ?? ()
#9  0x00007f9020761cdd in __libc_start_main () from /lib64/libc.so.6

有什么办法吗?现在我在cron中有一个任务,它会找到旧的对话框并杀死它们。

最佳答案

给定版本1.1-20080819是旧版本。例如,在2009/02/22中修复了一个相关问题:
修改DLGJReultTyKy()来将诅咒错误映射到对话框的错误出口
(改编自Domagoj Pensa的Patch)。
这又是对2007/07/04中所做更改的改进:
在wgetch()返回err时添加一个检查,以确保
输入/输出流仍然有效。如果那样的话,强迫
返回esc,退出对话框(由reiner huober报告)。
目前的版本是1.2-20150225

关于linux - Linux对话在中断的 session 中消耗100%的CPU,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/29562646/

10-14 09:22