进程在尝试连接服务器时变成僵尸状态,然后消失

进程在尝试连接服务器时变成僵尸状态,然后消失

我的服务器出现了连接问题:

  • 尝试连接时,ssh 经常会挂起
  • 有时其他命令会花费太多时间,例如su - someuser
  • 当我重新启动守护进程时,它很快就监听了 127.0.0.1,但监听我们的 VPN IP 地址却需要很长时间
  • 当我尝试编辑 sshd 配置文件时,需要花一些时间才能在 vi 中显示该文件

我尝试以更详细的信息运行 ssh,但我发现它在出现以下消息后挂起了:

debug1:进入交互式会话。

当它挂起并且我已经在服务器上打开了一个会话时,我可以查看进程列表,并且我可以看到如下内容:

root     19835  0.0  0.0  90308  3948 ?        Ss   10:25   0:00  \_ sshd: root [priv]   
sshd     19836  0.0  0.0      0     0 ?        Z    10:25   0:00      \_ [sshd] <defunct>

当我最终登录时,已停止的进程已经消失,并且具有 [priv] 的进程有一个正常的子进程:

root     19835  0.0  0.0  91524  4132 ?        Ss   10:25   0:00  \_ sshd: root@pts/3    
root     20898  3.3  0.1  24244  5264 pts/3    Ss+  10:27   0:00      \_ -bash

这是我挂起消息后得到的信息:

debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: packet_set_tos: set IP_TOS 0x10
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug1: Sending environment.
debug3: Ignored env IM_CONFIG_PHASE
debug3: Ignored env GNOME_KEYRING_CONTROL
debug3: Ignored env KONSOLE_DBUS_WINDOW
debug3: Ignored env SESSIONTYPE
debug3: Ignored env XCURSOR_THEME
debug3: Ignored env GTK_MODULES
debug3: Ignored env SESSION
debug3: Ignored env DEFAULTS_PATH
debug3: Ignored env XDG_DATA_DIRS
debug3: Ignored env XDG_SESSION_ID
debug3: Ignored env XDG_GREETER_DATA_DIR
debug3: Ignored env GPG_AGENT_INFO
debug3: Ignored env KDE_SESSION_UID
debug3: Ignored env PATH
debug3: Ignored env GNOME_KEYRING_PID
debug3: Ignored env KDE_FULL_SESSION
debug3: Ignored env CLUTTER_IM_MODULE
debug3: Ignored env DBUS_SESSION_BUS_ADDRESS
debug3: Ignored env UPSTART_INSTANCE
debug3: Ignored env XDG_VTNR
debug3: Ignored env QT_PLUGIN_PATH
debug3: Ignored env SELINUX_INIT
debug3: Ignored env LANGUAGE
debug3: Ignored env GDM_LANG
debug3: Ignored env GS_LIB
debug3: Ignored env SHELL_SESSION_ID
debug3: Ignored env XAUTHORITY
debug3: Ignored env TEXTDOMAIN
debug3: Ignored env DESKTOP_SESSION
debug3: Ignored env GTK_IM_MODULE
debug3: Ignored env KDE_MULTIHEAD
debug1: Sending env LANG = fr_FR.UTF-8
debug2: channel 0: request env confirm 0
debug3: Ignored env SSH_AGENT_PID
debug3: Ignored env SESSION_MANAGER
debug3: Ignored env SPEECHD_PORT
debug3: Ignored env KONSOLE_DBUS_SERVICE
debug3: Ignored env LOGNAME
debug3: Ignored env PWD
debug3: Ignored env SSH_AUTH_SOCK
debug3: Ignored env KONSOLE_PROFILE_NAME
debug3: Ignored env HOME
debug3: Ignored env GTK2_RC_FILES
debug3: Ignored env XDG_SESSION_PATH
debug3: Ignored env XDG_SEAT
debug3: Ignored env UPSTART_JOB
debug3: Ignored env QT4_IM_MODULE
debug3: Ignored env XMODIFIERS
debug3: Ignored env MANDATORY_PATH
debug3: Ignored env QT_IM_MODULE
debug3: Ignored env WINDOWID
debug3: Ignored env KDE_SESSION_VERSION
debug3: Ignored env COLORFGBG
debug3: Ignored env DISPLAY
debug3: Ignored env KONSOLE_DBUS_SESSION
debug3: Ignored env XDG_CURRENT_DESKTOP
debug3: Ignored env XDG_CONFIG_DIRS
debug3: Ignored env UPSTART_SESSION
debug3: Ignored env SHELL
debug3: Ignored env JOB
debug3: Ignored env TEXTDOMAINDIR
debug3: Ignored env SSH_AGENT_LAUNCHER
debug3: Ignored env XDG_RUNTIME_DIR
debug3: Ignored env NODE_PATH
debug3: Ignored env QT_QPA_PLATFORMTHEME
debug3: Ignored env GTK_RC_FILES
debug3: Ignored env PROFILEHOME
debug3: Ignored env XDG_SEAT_PATH
debug3: Ignored env TERM
debug3: Ignored env INSTANCE
debug3: Ignored env GDMSESSION
debug3: Ignored env USER
debug3: Ignored env UPSTART_EVENTS
debug3: Ignored env SHLVL
debug3: Ignored env OLDPWD
debug3: Ignored env GREP_OPTIONS
debug3: Ignored env GREP_COLOR
debug3: Ignored env PAGER
debug3: Ignored env LESS
debug1: Sending env LC_CTYPE = fr_FR.UTF-8
debug2: channel 0: request env confirm 0
debug3: Ignored env LSCOLORS
debug3: Ignored env EDITOR
debug3: Ignored env OLDHISTFILE
debug3: Ignored env OLDPATH
debug3: Ignored env rvm_prefix
debug3: Ignored env rvm_path
debug3: Ignored env __array_start
debug3: Ignored env rvm_uname
debug3: Ignored env rvm_tar
debug3: Ignored env rvm_bin_path
debug3: Ignored env escape_flag
debug3: Ignored env _first
debug3: Ignored env _second
debug3: Ignored env rvm_version
debug3: Ignored env _
debug2: channel 0: request shell confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0

可能是什么问题呢 ?

更新

strace su toto 输出在以下内容后挂起:

socket(PF_FILE, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 3
connect(3, {sa_family=AF_FILE, path="/dev/log"}, 110) = 0
sendto(3, "<86>Jul 25 11:19:39 su[28347]: S"..., 61, MSG_NOSIGNAL, NULL, 0) = 61
sendto(3, "<86>Jul 25 11:20:14 su[28347]: +"..., 53, MSG_NOSIGNAL, NULL, 0

答案1

找到了解决方案,我们正在登录到一个不存在的远程设施。

相关内容