Subject: hang in Faccept_process_output

From: Glenn Morris <[email-masked]>
Date: Wed, 18 Apr 2018 20:37:26 -0400

Package: emacs
Version: 27.0.50

Current master on RHEL7.4. If I do:

n=0
while : ; do
 let n++; echo $n
 rm -f test/src/process-tests.log
 make -C test src/process-tests.log \
   SELECTOR='\"make-process/mix-stderr$$\"' >& /dev/null
done

then eventually (after a few hundred loops), the spawned Emacs hangs in
Faccept_process_output. The associated external process is dead and
gone. gdb says:

#0  0x00007fe00d135879 in pselect () at /lib64/libc.so.6
#1  0x000000000068087e in really_call_select (arg=0x7ffda4c66e60)
    at thread.c:572
#2  0x00000000005d6f13 in flush_stack_call_func (func=0x6807ed <really_call_select>, arg=0x7ffda4c66e60) at alloc.c:5213
#3  0x0000000000680933 in thread_select (func=0x413330 <pselect@plt>, max_fds=10, rfds=0x7ffda4c67390, wfds=0x7ffda4c67310, efds=0x0, timeout=0x7ffda4c67680, sigmask=0x0) at thread.c:602
#4  0x00000000006aa642 in xg_select (fds_lim=10, rfds=0x7ffda4c67720, wfds=0x7ffda4c676a0, efds=0x0, timeout=0x7ffda4c67680, sigmask=0x0) at xgselect.c:117
#5  0x0000000000656410 in wait_reading_process_output (time_limit=0, nsecs=0, read_kbd=0, do_display=false, wait_for_cell=..., wait_proc=0x140b6a0, just_wait_proc=0) at process.c:5384
#6  0x00000000006547cf in Faccept_process_output (process=..., seconds=..., millisec=..., just_this_one=...) at process.c:4672

Maybe resembles https://debbugs.gnu.org/24201 ?
But Emacs is sleeping using no CPU.