[Bug 16229] New: waitpid fails after attach to processes that aren't group leaders

Bug ID 16229
Summary waitpid fails after attach to processes that aren’t group leaders
Product lldb
Version unspecified
Hardware PC
OS Linux
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@cs.uiuc.edu
Reporter andrew.kaylor@intel.com
Classification Unclassified

On Linux, when LLDB attaches to a process that is not a group leader the
MonitorChildProcessThread will terminate prematurely.  This happens because the
call to waitpid(-1*pid,...) fails with an ECHILD error.

It is possible to avoid this error by passing just -1 to waitpid, but that
results in signals for all children (including LLDB threads) to be reported. 
More investigation is required to determine the feasibility of this solution.

One situation in which this condition occurs is when the process to which we
are attaching is launched from a Python script using the subprocess.Popen
constructor.  This failure is demonstrated in the
CreateAfterAttach.test_create_after_attach_with_dwarf_and_popen test case.  A
workaround is demonstrated by the
CreateAfterAttach.test_create_after_attach_with_dwarf_and_popen test case. 
Both are in test/functionalities/thread/create_after_attach.

labath@google.com changed bug 16229

What | Removed | Added |

  • | - | - |
    Status | NEW | RESOLVED |
    CC | | labath@google.com |
    Resolution | — | FIXED |

Comment # 2 on bug 16229 from labath@google.com

Fixed. LLDB can now work with processes which are not group leaders and can
handle process changing it's group at runtime.