[PATCH 00/21] FIFO: Support multiple readers

Ken Brown kbrown@cornell.edu
Mon May 18 17:42:19 GMT 2020

Hi Takashi,

On 5/18/2020 12:03 PM, Ken Brown via Cygwin-patches wrote:
> On 5/18/2020 1:36 AM, Takashi Yano via Cygwin-patches wrote:
>> On Mon, 18 May 2020 14:25:19 +0900
>> Takashi Yano via Cygwin-patches <cygwin-patches@cygwin.com> wrote:
>>> However, mc hangs by several operations.
>>> To reproduce this:
>>> 1. Start mc with 'env SHELL=tcsh mc -a'
>> I mean 'env SHELL=/bin/tcsh mc -a'
>>> 2. Select a file using up/down cursor keys.
>>> 3. Press F3 (View) key.
> Thanks for the report.  I can reproduce the problem and will look into it.

I'm not convinced that this is a FIFO bug.  I tried two things.

1. I attached gdb to mc while it was hanging and got the following backtrace 

#1  0x00007ff901638037 in WaitForMultipleObjectsEx ()
#2  0x00007ff901637f1e in WaitForMultipleObjects ()
#3  0x0000000180048df5 in cygwait () at ...winsup/cygwin/cygwait.cc:75
#4  0x000000018019b1c0 in wait4 () at ...winsup/cygwin/wait.cc:80
#5  0x000000018019afea in waitpid () at ...winsup/cygwin/wait.cc:28
#6  0x000000018017d2d8 in pclose () at ...winsup/cygwin/syscalls.cc:4627
#7  0x000000018015943b in _sigfe () at sigfe.s:35
#8  0x000000010040d002 in get_popen_information () at filemanager/ext.c:561

So pclose is blocking after calling waitpid.  As far as I can tell from looking 
at backtraces of all threads, there are no FIFOs open.

2. I ran mc under strace (after exporting SHELL=/bin/tcsh), and I didn't see 
anything suspicious involving FIFOs.  But I saw many EBADF errors from fstat and 
close that don't appear to be related to FIFOs.

So my best guess at this point is that the FIFO changes just exposed some 
unrelated bug(s).

Prior to the FIFO changes, mc would get an error when it tried to open tcsh_fifo 
the second time, and it would then set

   mc_global.tty.use_subshell = FALSE;

see the mc source file subshell/common.c:1087.


More information about the Cygwin-patches mailing list