<div>Dear all,</div><br><div>Does anyone have any feedback on this issue? The problem still persists in MPICH-3.3 and it seems like it is pointing to a severe flaw in how MPICH handles dynamic process creation. To reiterate, the following short program using MPICH creates zombie processes indefinitely until no more processes can be created.</div><br><div>"""</div><div><font style="font-family:monospace">#include <stdio.h></font></div><div><font style="font-family:monospace">#include <mpi.h></font></div><br><div><font style="font-family:monospace">int main(int argc, char *argv[]) {</font></div><br><div><font style="font-family:monospace">    // Initialize MPI</font></div><div><font style="font-family:monospace">    MPI_Init(NULL, NULL);</font></div><br><div><font style="font-family:monospace">    // Get parent</font></div><div><font style="font-family:monospace">    MPI_Comm parent;</font></div><div><font style="font-family:monospace">    MPI_Comm_get_parent(&parent);</font></div><br><div><font style="font-family:monospace">    // If the process was not spawned</font></div><div><font style="font-family:monospace">    if (parent == MPI_COMM_NULL) {</font></div><br><div><font style="font-family:monospace">        puts("I was not spawned!");</font></div><br><div><font style="font-family:monospace">        // Spawn child process in loop</font></div><div><font style="font-family:monospace">        char *cmd = argv[0];</font></div><div><font style="font-family:monospace">        char **cmd_argv = MPI_ARGV_NULL;</font></div><div><font style="font-family:monospace">        int maxprocs = 1;</font></div><div><font style="font-family:monospace">        MPI_Info info = MPI_INFO_NULL;</font></div><div><font style="font-family:monospace">        int root = 0;</font></div><div><font style="font-family:monospace">        MPI_Comm comm = MPI_COMM_SELF;</font></div><div><font style="font-family:monospace">        MPI_Comm intercomm;</font></div><div><font style="font-family:monospace">        int *array_of_errcodes = MPI_ERRCODES_IGNORE;</font></div><br><div><font style="font-family:monospace">        for (;;) {</font></div><div><font style="font-family:monospace">            MPI_Comm_spawn(cmd, cmd_argv, maxprocs, info, root, comm,</font></div><div><font style="font-family:monospace">                    &intercomm, array_of_errcodes);</font></div><br><div><font style="font-family:monospace">            MPI_Comm_disconnect(&intercomm);</font></div><div><font style="font-family:monospace">        }</font></div><br><div><font style="font-family:monospace">    // If process was spawned</font></div><div><font style="font-family:monospace">    } else {</font></div><br><div><font style="font-family:monospace">        puts("I was spawned!");</font></div><br><div><font style="font-family:monospace">        MPI_Comm_disconnect(&parent);</font></div><div><font style="font-family:monospace">    }</font></div><br><div><font style="font-family:monospace">    // Finalize</font></div><div><font style="font-family:monospace">    MPI_Finalize();</font></div><br><div><font style="font-family:monospace">}</font></div><div>"""</div><br><div>Thanks in advance for your help.</div><br><div>Best wishes,</div><div>Thomas Pak</div><br><div class="gmail_quote_attribution">On Oct 16 2018, at 4:57 pm, Thomas Pak <thomas.pak@maths.ox.ac.uk> wrote:</div><blockquote><br><div><div>Dear all,</div><br><div>My MPI application spawns a large number of MPI processes using MPI_Comm_spawn over its total lifetime. Unfortunately, I have experienced that this results in zombie processes of hydra_pmi_proxy accumulating over time. As a result, my MPI application will eventually crash because there are too many zombie processes and no new processes can be created.</div><br><div>This issue does not seem to be new; I have found references to similar issues in at least three different places:</div><br><div>- <a href="https://lists.mpich.org/pipermail/discuss/2013-March/000599.html" title="https://lists.mpich.org/pipermail/discuss/2013-March/000599.html">[mpich-discuss] MPI_Comm_Spawn causing zombies of hydra_pmi_proxy</a> (March 2013)</div><div>- <a href="https://github.com/pmodels/mpich/issues/1677" title="https://github.com/pmodels/mpich/issues/1677">[GitHub issue] hydra_pmi_proxy zombie MPI_comm_spawn #1677</a> (October 2016)</div><div>- <a href="https://groups.google.com/forum/#!msg/mpi4py/A9mN-2UkFf8/2gnUEtArDwAJ" title="https://groups.google.com/forum/#!msg/mpi4py/A9mN-2UkFf8/2gnUEtArDwAJ">[Google Groups] Hanging in spawn in master-slave code and hydra_pmi_proxy zombies</a> (December 2016)</div><div>In the first reference, a dirty fix was proposed by Silvan Brändli to simply reap all the zombie processes in a loop at the start of the function HYDU_create_process in src/pm/hydra/utils/launch/launch.c. However, I have found that this comes with its own set of problems and makes my MPI application unstable.</div><br><div>In the GitHub issue, the problem was marked as "worksforme". However, this problem persists for me and other machines that I have tried to reproduce it on, so it clearly has not yet been resolved.</div><br><div>In the Google Groups thread, the problem was "resolved" by avoiding spawning MPI processes entirely, which is not an option in my case.</div><br><div>Pavan Balaji mentions in the 2013 mpi-discuss thread that this issue was a problem "once upon a time". It seems to have risen from the dead again.</div><br><div>I have attached a short and self-contained program written in C that reproduces the problem. The program simply spawns child processes using MPI_Comm_spawn in an infinite loop, where each child process exits after writing a message to stdout. I use MPI_Comm_disconnect to disconnect the Intercommunicator, but the same problem occurs when using MPI_Comm_free instead.</div><br><div>I have also attached the logfiles generated while building MPICH, as described in the README, except for the file mpich-3.2.1/src/pm/hydra/tools/topo/hwloc/hwloc/config.log, as that was missing. I am using MPICH version 3.2.1, which is the latest stable release at the time of writing.</div><br><div>Thanks in advance for your help!</div><br><div>Best wishes,</div><div>Thomas Pak</div><div>_______________________________________________</div><div>discuss mailing list discuss@mpich.org</div><div>To manage subscription options or unsubscribe:</div><div>https://lists.mpich.org/mailman/listinfo/discuss</div></div></blockquote>