AWS EC2 终端会话终止于 "Plugin with name Standard_Stream not found"

AWS EC2 terminal session terminated with "Plugin with name Standard_Stream not found"

我在 AWS EC2 CentOS 7 上传输 Kafka。我的会话管理器空闲超时设置为 60 分钟。然而,在 运行 之后,终端冻结了,显示 My session has been terminated。当然,Kafka streaming for disrupted 也是如此。

当我尝试使用新终端重新启动新会话时,出现此错误弹出窗口

Your session has been terminated for the following reasons: Plugin with name Standard_Stream not found. Step name: Standard_Stream

我仍然无法重启终端。

这个错误是什么意思,如何解决?谢谢

  • 到目前为止,您需要使用 SSH 和 key-pem 访问 EC2 进行调试 (询问您的管理员)

运行 tail -f 有问题

tail: inotify resources exhausted
tail: inotify cannot be used, reverting to polling
  • 重启 ssm-agent 服务也有问题No space left on device 但它与磁盘无关 space

    [root@env-test ec2-user]# systemctl restart amazon-ssm-agent.service 错误:没有 space 留在设备上

    [root@env-test ec2-user]# df -h |grep dev devtmpfs 32G 0 32G 0% /开发 tmpfs 32G 0 32G 0% /dev/shm /dev/nvme0n1p1100G 82G 18G 83% /

  • 所以错误本身意味着系统的 inotify 越来越低 watches,使程序能够监视 file/dirs 更改。查看 当前设置的限制(包括我机器上的输出)

    $猫/proc/sys/fs/inotify/max_user_watches

    8192

检查哪些进程使用 inotify 来改进你的 apps 或增加 max_user_watches

for foo in /proc/*/fd/*; do readlink -f $foo; done | grep inotify | sort | uniq -c | sort -nr
5 /proc/1/fd/anon_inode:inotify
2 /proc/7126/fd/anon_inode:inotify
2 /proc/5130/fd/anon_inode:inotify
1 /proc/4497/fd/anon_inode:inotify
1 /proc/4437/fd/anon_inode:inotify
1 /proc/4151/fd/anon_inode:inotify
1 /proc/4147/fd/anon_inode:inotify
1 /proc/4028/fd/anon_inode:inotify
1 /proc/3913/fd/anon_inode:inotify
1 /proc/3841/fd/anon_inode:inotify
1 /proc/31146/fd/anon_inode:inotify
1 /proc/2829/fd/anon_inode:inotify
1 /proc/21259/fd/anon_inode:inotify
1 /proc/1934/fd/anon_inode:notify
  • 注意上面的inotify列表包括ssm-agent的PID 过程,它解释了为什么我们在使用 SSM 时遇到问题 max_user_watches 达到上限

ps-ef | grep ssm-ag

root      3841     1  0 00:02 ?        00:00:05 /usr/bin/amazon-ssm-agent
root      4497  3841  0 00:02 ?        00:00:33 /usr/bin/ssm-agent-worker
  • 最终解决方案:永久解决方案(重启后保留)

echo "fs.inotify.max_user_watches=1048576" >> /etc/sysctl.conf sysctl -p

  • 验证:

    $ aws ssm start-session --target i-123abc456efd789xx --region ap-northeast-2

正在使用 SessionId 启动会话:userdev-03ccb1a04a6345bf5

sh-4.2$

  • 此问题来自 EC2 实例,与 SSM 代理无关转到 link 不理解 SSM 代理。

可选link

就我而言,扩展磁盘 space 有效! (系统日志充满了我的案例)

在我的例子中,扩展磁盘 space 工作正常,因为我的 /var/logs 很大。