[Lldb-commits] [lldb] [lldb][Windows] Fix lldb-server exit deadlock with pipe-mode stdio (PR #227273)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 6 12:53:49 PDT 2026
================
@@ -34,14 +34,12 @@ size_t ConnectionConPTY::Read(void *dst, size_t dst_len,
const Timeout<std::micro> &timeout,
lldb::ConnectionStatus &status,
Status *error_ptr) {
- {
- std::unique_lock<std::mutex> guard(m_pty->GetMutex());
- if (m_pty->IsStopping())
- m_pty->GetCV().wait(guard, [this] { return !m_pty->IsStopping(); });
- if (!m_pty->IsConnected()) {
- status = eConnectionStatusEndOfFile;
- return 0;
- }
+ bool open = m_pty->GetMode() == PseudoConsole::Mode::ConPTY
+ ? m_pty->GetSTDOUTHandle() != INVALID_HANDLE_VALUE
+ : m_pty->IsConnected();
+ if (!open) {
+ status = eConnectionStatusEndOfFile;
+ return 0;
}
----------------
Nerixyz wrote:
Can we have the following scenario and if so what would be the outcome?
- Mode is `Pipe` and `open` is `true` (i.e. `IsConnected()` returned `true`).
- Another thread calls `pty.Close()`.
- This thread runs `ConnectionGenericFile::Read`
I'm guessing this will time out. But reading further, `m_stdio_communication.InterruptRead()` is supposed to prevent the timeout[?]
https://github.com/llvm/llvm-project/pull/227273
More information about the lldb-commits
mailing list