[Lldb-commits] [PATCH] Fix on Linux for ReadThread lingering after inferior exits
Alex Pepper
apepper at blueshiftinc.com
Wed Aug 13 13:47:08 PDT 2014
This patch handles the case where the inferior process exits but leaves the
ReadThread in a continuous loop reading from the communication pipe. On
MacOSX, the ReadThread exits when it receives a 0 return value from the
read due to EOF. On Linux the read returns -1 and sets errno to EIO error,
this does not currently cause the thread to shutdown so it continues to
read from the comm. In Communication::ReadThread I added a handler for
eConnectionStatusError to disconnect and shutdown the thread.
We ran this through the full test suite on Ubuntu 14.04 x86_64 and MacOSX
10.9.4 with Xcode 6 Beta 5 with no new test failures.
Let me know if there is a reason we shouldn't be handling the
eConnectionStatusError in this way.
Thanks,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20140813/42f10ad2/attachment.html>
-------------- next part --------------
diff --git a/source/Core/Communication.cpp b/source/Core/Communication.cpp
index 20231c4..a6005da 100644
--- a/source/Core/Communication.cpp
+++ b/source/Core/Communication.cpp
@@ -380,13 +380,24 @@ Communication::ReadThread (lldb::thread_arg_t p)
if (comm->GetCloseOnEOF())
done = true;
break;
+ case eConnectionStatusError: // Check GetError() for details
+ if (error.GetError() == EIO)
+ {
+ // EIO on a pipe is usually caused by remote shutdown
+ comm->Disconnect ();
+ done = true;
+ }
+ if (log)
+ error.LogIfError (log,
+ "%p Communication::ReadFromConnection () => status = %s",
+ p,
+ Communication::ConnectionStatusAsCString (status));
+ break;
case eConnectionStatusNoConnection: // No connection
case eConnectionStatusLostConnection: // Lost connection while connected to a valid connection
case eConnectionStatusInterrupted: // Interrupted
-
done = true;
// Fall through...
- case eConnectionStatusError: // Check GetError() for details
case eConnectionStatusTimedOut: // Request timed out
if (log)
error.LogIfError (log,
More information about the lldb-commits
mailing list