GNU bug report logs - #56002
src/process.c; make-process fails to clean up stderr process on early exit

Previous Next

Package: emacs;

Reported by: Tom Gillespie <tgbugs <at> gmail.com>

Date: Wed, 15 Jun 2022 22:39:01 UTC

Severity: normal

Full log


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

From: Tom Gillespie <tgbugs <at> gmail.com>
To: 56002 <at> debbugs.gnu.org
Subject: update with an additional example
Date: Wed, 15 Jun 2022 19:28:21 -0700
I have been reading the docs on accepting output again,
and I see that there might be some subtlety here, but in
fact following the examples in the docs should reveal
another way the bug can express itself.

Specifically, in the original example I did not call
accept-process-output on the stderr process as is
suggested by the docs. Unfortunately, the docs are
misleading in this case because I am doing things
inside an unwind-protect cleanup clause and
accepting output from the stderr process causes
the example (below) to hang forever.

I think this happens because the stderr process is not
cleaned up correctly, OR possibly because of some
unexpected interaction due to the use of unwind-protect.

Example:
#+begin_src bash
read -r -d '' example <<'EOF'
(let ((stderr-buffer (generate-new-buffer " rc stderr")))
  (unwind-protect
      (let ((process
             (make-process
              :name "process that never actually starts"
              :stderr stderr-buffer
              :command '("i_fail_before_there_can_be_a_return_code"))))
        (message "this will never print because we never get here")
        (while (accept-process-output process)))
    (while (accept-process-output (get-buffer-process stderr-buffer)))
    (kill-buffer stderr-buffer)))
EOF
emacs -Q -batch -eval "${example}"
#+end_src

Docs in question:
https://www.gnu.org/software/emacs/manual/html_node/elisp/Accepting-Output.html




This bug report was last modified 2 years and 314 days ago.

Previous Next


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