Skip to content

mosh-server deadlocks on large pastes #1356

@mooey5775

Description

@mooey5775

mosh-server deadlocks when pastes >~10KB are pasted into something like vim.

The root cause is the mosh-server calling write into the fakepty master fd with size exceeding the kernel's fd buffer size. Vim stops consuming stdin as it has echoed the large output back to the user in stdout which is not being consumed by mosh-server as it's in a blocking write. So the stdout kernel buffer fills up and now we are in a deadlock.

I have some code that works for me on my fork (mooey5775@0b53d07) by adding buffering to the write on the fakepty master fd. It passes all current tests but may be a undesirable as:

  • the buffer is 256 KB
  • the circular buffer is some random implementation, maybe there is something more principled
  • not sure about cross-platform portability?

but if you'd like it as a PR anyways please let me know, I can open one

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions