[Bug 25652] New: [linux] I/O over pty arrives asynchronously, which confuses LLDB

Bug ID 25652
Summary [linux] I/O over pty arrives asynchronously, which confuses LLDB
Product lldb
Version unspecified
Hardware PC
OS Linux
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@lists.llvm.org
Reporter labath@google.com
CC llvm-bugs@lists.llvm.org
Classification Unclassified

According to this <[https://lkml.org/lkml/2015/11/3/795](https://lkml.org/lkml/2015/11/3/795)> discussion, there is
basically no guarantee about when will I/O from the inferior process arrive.
Specifically, it can arrive after we have it has stopped and we think we have
forwarded all of its input. This can cause two problems:
- the test suite sometimes checks the output of the process to verify it has
done the right thing. The late arrival of this text can cause flakyness.
- gdb-remote protocol does not support forwarding I/O when the process is
stopped. Currently, we will still attempt to do that and then things will

The possible fixes for this would be: patching the kernel (which is a
possibility they seemed opened (or at least not opposed) to), inserting sleeps
or stopping using stdio in tests.

Although it is possible to reliably reproduce it with a specially crafted
program, I have seen this happen on the buildbot only once. Given that this
does not seem to happen very often, it does not seem like a big priority.

However, we should do something about the protocol forwarding issue, because
when this happens, and we are forwarding I/O, the entire debug session will
break down, which is not good.