<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/90923>90923</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            lldb-server on Windows in platform mode does not reuse ports correctly
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Awfa
      </td>
    </tr>
</table>

<pre>
    On both Linux and Windows, when lldb-server is in platform mode, the first connection gets handed the portmap defined by `--min-gdb-serverport` and `--max-gdb-serverport`. Subsequent connections don't receive this portmap because it has been `std::move`'d for the fork'ed child process to handle.

https://github.com/llvm/llvm-project/pull/88845/ will fix this for Linux, but on Windows, the problem will only be partially fixed by the PR.
After the PR lands, Window's lldb-server will be able to use the port map for multiple connections but will fail to reclaim ports as they are given out to each connection. After enough connections, there won't be any more ports for server to give out.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUU8GOozgQ_RpzKQU5hhA4cMhuK6eVdrVzmLONC_CMcTG2SZq_HxnS3Wn1aS6JRJXfe_VelQzBDA6xZae_2Oklk0scybeXey8zRXpt_3WgKI7wj3HLK0in4btxmu6Bib_hPqIDa7U6BPQ39GACGAezlbEnP8FEGlNfHBF640OEjpzDLhpyMGAMMEqnUW8NM_k4yRk09sahBrUCq_jhMBl3GN4pUher-KZkL8vXr-Ucvi0q4K8F3TNnAE2OiXMEjx2aG0IcTXhnVtjJJSCYCKMMoBBd4ghRs-LCistEN2QVZ-KsoSe_j0X-JxNn1NCNxmqYPXUYAkTaZrOYM_7C-GX_HWOcQwITVyaug4njovKOJiau1t7e_g6zpx_YRSau82ItE9e6rssTE1e4G2uhN6-78CRiCyaZrJYI5J7j2Vz1pCxO-0NydgWFMEsfjbR2TVC71an3v_8fYi99RP_4BFY6vcHtyEycw6fMN2SFIJXFNHZy8C1PSLYmldNio5ktfgojKd4Hksampx47K820PQ0gQ8JZQXqEwdzQAS0xtaHsxiegHHa96GgZngtvJniE-yP3pNOtMJHHB0tS95gk0saTaPJMt4VuikZm2B7Px7JqqrKos7HVTX86H6uiOWoluhqxarRq6mMvq3N_wjozreCi5CdecF4UpzqvOcqyEmUvCqGPvGIlx0kam6esc_JDZkJYsG14I4rMSoU2bPcohMM7bEUmRDpP3277oZYhsJJbE2L4QIkmWmyfo_lYhy9nCZowgKN0Cimx3YyOvMcu2jVbvG3_eFs3qYGJ6zbK7wAAAP__-A18rw">