Subject: Re: bug#28544: 26.0.50; emacs will consume 100% cpu after gdb debugee exits

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 16 Aug 2020 18:46:48 +0200

Sung Ho Kim <[email-masked]> writes:

> after rebuilding with the aforementioned change, the 100% cpu usage
> disappears.  I have refrained from offering a patch because I am not
> fully knowledgeable with the code and its possible side effects.

Well, that's unfortunate, because without a patch it's difficult to
interpret just what it is you're proposing.

If I piece together the code correctly, you're saying the following
patch fixes the problem on Macos?

diff --git a/src/process.c b/src/process.c
index 15634e4a8b..740891983e 100644
--- a/src/process.c
+++ b/src/process.c
@@ -5821,7 +5821,9 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
 		 EIO, just continue, because the child process has
 		 exited and should clean itself up soon (e.g. when we
 		 get a SIGCHLD).  */
-	      else if (nread == -1 && errno == EIO)
+ 	      else if (nread == 0 && !NETCONN_P (proc) && !SERIALCONN_P (proc)
+ 		       && !PIPECONN_P (proc))
+#ifdef DARWIN_OS
 		{
 		  struct Lisp_Process *p = XPROCESS (proc);
 
@@ -5838,6 +5840,9 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
 		      pset_status (p, Qfailed);
 		    }
 		}
+#else
+	      ;
+#endif
 #endif /* HAVE_PTYS */
 	      /* If we can detect process termination, don't consider the
 		 process gone just because its pipe is closed.  */

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no