[Lldb-commits] [lldb] r235008 - Bug 23051 - Fix zombie processes after lldb-server tests

Ilia K ki.stfu at gmail.com
Wed Apr 15 06:35:49 PDT 2015


Author: ki.stfu
Date: Wed Apr 15 08:35:49 2015
New Revision: 235008

URL: http://llvm.org/viewvc/llvm-project?rev=235008&view=rev
Log:
Bug 23051 - Fix zombie processes after lldb-server tests

Summary:
This patch fixes the following bug: https://llvm.org/bugs/show_bug.cgi?id=23181
For some reason some lldb-server tests should be kicked using SIGHUP and SIGINT before termination, otherwise it will leave a zombie process.
I think the reason is that the lldb-server will terminate a slave process if it gets the SIGHUP/SIGINT and if so it should be fixed in lldb-server.

The solution is to terminate process like it does the pexpect (including the delayafterterminate interval).

Also this patch reverts the following commits:
* r234549 - Skip lldb-server tests according to bug 23181
* r234765 - Skip a few tests on OS X according to the bug 23181
* r234803 - Skip the TestGdbRemoteRegisterState.test_grp_register_save_restore_works_no_suffix_debugserver_dsym test on OS X according to the bug 23181

Test Plan:
```
$ ps | grep Z | grep a.out | wc -l
447
$ ./dosep.py --options "-v --executable $INSTALLDIR/bin/lldb"
[...]
$ ps | grep Z | grep a.out | wc -l
447
```

Reviewers: jasonmolenda, clayborg, tberghammer

Reviewed By: clayborg

Subscribers: lldb-commits, dawn, tberghammer, clayborg, jasonmolenda

Differential Revision: http://reviews.llvm.org/D9019

Modified:
    lldb/trunk/test/functionalities/register/TestRegisters.py
    lldb/trunk/test/lldbtest.py
    lldb/trunk/test/tools/lldb-server/TestGdbRemoteRegisterState.py
    lldb/trunk/test/tools/lldb-server/TestGdbRemoteSingleStep.py
    lldb/trunk/test/tools/lldb-server/TestGdbRemote_vCont.py
    lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py
    lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
    lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py

Modified: lldb/trunk/test/functionalities/register/TestRegisters.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/register/TestRegisters.py?rev=235008&r1=235007&r2=235008&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/register/TestRegisters.py (original)
+++ lldb/trunk/test/functionalities/register/TestRegisters.py Wed Apr 15 08:35:49 2015
@@ -58,7 +58,6 @@ class RegisterCommandsTestCase(TestBase)
         self.buildDefault()
         self.convenience_registers_with_process_attach(test_16bit_regs=False)
 
-    @skipIfDarwin # https://llvm.org/bugs/show_bug.cgi?id=23181: Some lldb-server tests become zombies
     @skipIfFreeBSD # llvm.org/pr18230
     @expectedFailureFreeBSD("llvm.org/pr18200")
     def test_convenience_registers_16bit_with_process_attach(self):

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=235008&r1=235007&r2=235008&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Wed Apr 15 08:35:49 2015
@@ -255,6 +255,7 @@ class _LocalProcess(_BaseProcess):
     def __init__(self, trace_on):
         self._proc = None
         self._trace_on = trace_on
+        self._delayafterterminate = 0.1
 
     @property
     def pid(self):
@@ -267,7 +268,25 @@ class _LocalProcess(_BaseProcess):
 
     def terminate(self):
         if self._proc.poll() == None:
+            # Terminate _proc like it does the pexpect
+            self._proc.send_signal(signal.SIGHUP)
+            time.sleep(self._delayafterterminate)
+            if self._proc.poll() != None:
+                return
+            self._proc.send_signal(signal.SIGCONT)
+            time.sleep(self._delayafterterminate)
+            if self._proc.poll() != None:
+                return
+            self._proc.send_signal(signal.SIGINT)
+            time.sleep(self._delayafterterminate)
+            if self._proc.poll() != None:
+                return
             self._proc.terminate()
+            time.sleep(self._delayafterterminate)
+            if self._proc.poll() != None:
+                return
+            self._proc.kill()
+            time.sleep(self._delayafterterminate)
 
     def poll(self):
         return self._proc.poll()

Modified: lldb/trunk/test/tools/lldb-server/TestGdbRemoteRegisterState.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/TestGdbRemoteRegisterState.py?rev=235008&r1=235007&r2=235008&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/TestGdbRemoteRegisterState.py (original)
+++ lldb/trunk/test/tools/lldb-server/TestGdbRemoteRegisterState.py Wed Apr 15 08:35:49 2015
@@ -109,7 +109,6 @@ class TestGdbRemoteRegisterState(gdbremo
 
     @debugserver_test
     @dsym_test
-    @skipIfDarwin # https://llvm.org/bugs/show_bug.cgi?id=23181: Some lldb-server tests become zombies
     def test_grp_register_save_restore_works_no_suffix_debugserver_dsym(self):
         USE_THREAD_SUFFIX = False
         self.init_debugserver_test()

Modified: lldb/trunk/test/tools/lldb-server/TestGdbRemoteSingleStep.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/TestGdbRemoteSingleStep.py?rev=235008&r1=235007&r2=235008&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/TestGdbRemoteSingleStep.py (original)
+++ lldb/trunk/test/tools/lldb-server/TestGdbRemoteSingleStep.py Wed Apr 15 08:35:49 2015
@@ -7,7 +7,6 @@ class TestGdbRemoteSingleStep(gdbremote_
 
     @debugserver_test
     @dsym_test
-    @skipIfDarwin # https://llvm.org/bugs/show_bug.cgi?id=23181: Some lldb-server tests become zombies
     def test_single_step_only_steps_one_instruction_with_s_debugserver_dsym(self):
         self.init_debugserver_test()
         self.buildDsym()

Modified: lldb/trunk/test/tools/lldb-server/TestGdbRemote_vCont.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/TestGdbRemote_vCont.py?rev=235008&r1=235007&r2=235008&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/TestGdbRemote_vCont.py (original)
+++ lldb/trunk/test/tools/lldb-server/TestGdbRemote_vCont.py Wed Apr 15 08:35:49 2015
@@ -90,7 +90,6 @@ class TestGdbRemote_vCont(gdbremote_test
 
     @debugserver_test
     @dsym_test
-    @skipIfDarwin # https://llvm.org/bugs/show_bug.cgi?id=23181: Some lldb-server tests become zombies
     def test_single_step_only_steps_one_instruction_with_Hc_vCont_s_debugserver_dsym(self):
         self.init_debugserver_test()
         self.buildDsym()
@@ -107,7 +106,6 @@ class TestGdbRemote_vCont(gdbremote_test
 
     @debugserver_test
     @dsym_test
-    @skipIfDarwin # https://llvm.org/bugs/show_bug.cgi?id=23181: Some lldb-server tests become zombies
     def test_single_step_only_steps_one_instruction_with_vCont_s_thread_debugserver_dsym(self):
         self.init_debugserver_test()
         self.buildDsym()

Modified: lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py?rev=235008&r1=235007&r2=235008&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py (original)
+++ lldb/trunk/test/tools/lldb-server/TestLldbGdbServer.py Wed Apr 15 08:35:49 2015
@@ -689,7 +689,6 @@ class LldbGdbServerTestCase(gdbremote_te
 
     @debugserver_test
     @dsym_test
-    @skipIfDarwin # https://llvm.org/bugs/show_bug.cgi?id=23181: Some lldb-server tests become zombies
     def test_p_returns_correct_data_size_for_each_qRegisterInfo_attach_debugserver_dsym(self):
         self.init_debugserver_test()
         self.buildDsym()
@@ -869,7 +868,6 @@ class LldbGdbServerTestCase(gdbremote_te
 
     @debugserver_test
     @dsym_test
-    @skipIfDarwin # https://llvm.org/bugs/show_bug.cgi?id=23181: Some lldb-server tests become zombies
     @unittest2.expectedFailure()
     def test_Hc_then_Csignal_signals_correct_thread_launch_debugserver_dsym(self):
         self.init_debugserver_test()

Modified: lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py?rev=235008&r1=235007&r2=235008&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py (original)
+++ lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py Wed Apr 15 08:35:49 2015
@@ -25,7 +25,6 @@ class TestGdbRemoteAbort(gdbremote_testc
 
     @debugserver_test
     @dsym_test
-    @skipIfDarwin # https://llvm.org/bugs/show_bug.cgi?id=23181: Some lldb-server tests become zombies
     def test_inferior_abort_received_debugserver_dsym(self):
         self.init_debugserver_test()
         self.buildDsym()

Modified: lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py?rev=235008&r1=235007&r2=235008&view=diff
==============================================================================
--- lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py (original)
+++ lldb/trunk/test/tools/lldb-server/inferior-crash/TestGdbRemoteSegFault.py Wed Apr 15 08:35:49 2015
@@ -27,7 +27,6 @@ class TestGdbRemoteSegFault(gdbremote_te
 
     @debugserver_test
     @dsym_test
-    @skipIfDarwin # https://llvm.org/bugs/show_bug.cgi?id=23181: Some lldb-server tests become zombies
     def test_inferior_seg_fault_received_debugserver_dsym(self):
         self.init_debugserver_test()
         self.buildDsym()





More information about the lldb-commits mailing list