GNU bug report logs - #79436
[PATCH] Use up-to-date time in wait_reading_process_output

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Fri, 12 Sep 2025 15:40:03 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 79436 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to eggert <at> cs.ucla.edu, dmitry <at> gutov.dev, bug-gnu-emacs <at> gnu.org:
bug#79436; Package emacs. (Fri, 12 Sep 2025 15:40:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Spencer Baugh <sbaugh <at> janestreet.com>:
New bug report received and forwarded. Copy sent to eggert <at> cs.ucla.edu, dmitry <at> gutov.dev, bug-gnu-emacs <at> gnu.org. (Fri, 12 Sep 2025 15:40:06 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Use up-to-date time in wait_reading_process_output
Date: Fri, 12 Sep 2025 11:38:29 -0400
[Message part 1 (text/plain, inline)]
Tags: patch


Compile the following C program, close_and_sit.c:

#include <stdio.h>
#include <unistd.h>
void main() {
  fclose(stdout);
  fclose(stderr);
  while (1) sleep(1);
}

Then run this snippet of Lisp, updating the executable file name
appropriately:

(make-process
 :name "close_and_sit"
 :command '("./close_and_sit")
 :connection-type 'pipe)
(make-process :name "true" :command '("true"))
(message "accept-process-output")
(accept-process-output nil 1)

This will cause Emacs to hang; accept-process-output will never time
out.

There are two bugs which combine to cause this.

The first bug is in our timeout handling.  The attached patch resolves
that, which causes accept-process-output to time out properly and fixes
the bug.

Paul, this patch partially reverts a change you made to cache
current_timespec.  Does it seem right to you?

The second bug is that when a child process closes stdout/stderr, we
continue watching the pipe, generating spurious events.  (We should
still be timing out despite the spurious events - real events could also
cause this hang, this bug just makes it easier to trigger the hang.)
I'm still working on a patch to fix the second bug.

[0001-Use-up-to-date-time-in-wait_reading_process_output.patch (text/patch, attachment)]

This bug report was last modified 6 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.