URL:
  <http://savannah.gnu.org/bugs/?54427>

                 Summary: make can block after being killed
                 Project: make
            Submitted by: kvho
            Submitted on: Thu 02 Aug 2018 01:04:35 PM CEST
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 4.2.1
        Operating System: POSIX-Based
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

job.c, line 1002
#ifndef NO_OUTPUT_SYNC
      /* Synchronize any remaining parallel output.  */
      output_dump (&c->output);
#endif

This happens in a 'critical' section.
a child has finished, but job_slots_used has not yet decremented.

When a fatal signal arrives, during output_dump, fatal_error_signal is
calling
      while (job_slots_used > 0)
        reap_children (1, 0);
Since job_slots_used is 1 higher than the number of children, reap_children is
called eventually, without any child, and it will block on 'EINTRLOOP (pid,
wait (&status)'

Solution: reorder some statements.
/* There is now another slot open.  */
      if (job_slots_used > 0)
        --job_slots_used;

      /* Remove the child from the chain and free it.  */
      if (lastc == 0)
        children = c->next;
      else
        lastc->next = c->next;

      unblock_sigs ();
#ifndef NO_OUTPUT_SYNC
      /* Synchronize any remaining parallel output.  */
      output_dump (&c->output);
#endif
      free_child (c);      





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?54427>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/


_______________________________________________
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make

Reply via email to