mosh-server 在大量粘贴时发生死锁
作者: mooey5775创建于 2025年10月21日更新于 2026年10月1日
mosh-server 当粘贴 >~10KB 的内容到 vim 等程序时会陷入死锁。 根本原因是 mosh-server 向 fakepty 主 fd 发出 `write` 调用,而 fd 的大小超过了内核的 fd 缓冲区大小。 vim 停止消耗 stdin,因为它已经将大量输出回显到用户的 stdout,而 mosh-server 则无法消耗 stdout,因为它正处于阻塞写入状态。 因此,stdout 内核缓冲区填满,我们陷入了死锁。
内容来源: mobile-shell/mosh