<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/121722>121722</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
lldb-dap 19+ hangs on Windows
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
SuibianP
</td>
</tr>
</table>
<pre>
## Summary
Since 19.1.0 release, official `lldb-dap` binary releases has been hanging on Windows.
## Symptom
- Neither locally built `Debug` nor `RelWithDbgInfo` builds exhibits the same issue; only the official binaries does
- Launching `lldb-dap` on the terminal, interactively inputting lines then Ctrl-C: No input is consumed
- Launching `lldb-dap` with `-p`: TCP port is not opened
- VSCode LLDB-DAP extension or emacs dape: Hangs and times out respectively
- `LLDBDAP_LOG` file gets created but is empty
- Running under WinDbg: Nondeterministic behaviour
* Same issue as above
* Fatal Python error: can’t initialize sys standard streams
* Working correctly
## Suspected cause
The issue may be related to Python in some way, as the system Python version (that local builds link against?) differs from the version used by official binaries (3.10 embeddable package). More specifically, I speculate it might be some race condition between Python [`init_sys_streams`](https://github.com/python/cpython/blob/3.10/Python/pylifecycle.c#L2403) and lldb-dap [`_setmode` call inside DAP constructor](https://github.com/llvm/llvm-project/blob/bcc1e584483c8246b651290b0c2d696bd57006a9/lldb/tools/lldb-dap/DAP.cpp#L48-L57).
## Furum reports
https://discourse.llvm.org/t/lldb-dap-frozen-on-windows/83652
https://discourse.llvm.org/t/lldb-dap-in-vscode/83771
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJycVU2P2zYQ_TX0ZWCDoizZPvjgXddtgG26yAbNccGPkTQNRQok5Y3y6wvKH0mKokV7sjUk37w384aUMVLrEPesemDVcSHH1PmwfxlJkXTPC-XNtGeiZKKEl7HvZZgYPzB-eCGnEYrdqlhxCGhRRmTiEXzTkCZpgdXcWqOWRg6s5qDIyTDddkboZASF6KCTriXXgnfwiZ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