This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Regression (last snapshot)


On 7/29/2019 2:55 PM, Ken Brown wrote:
> On 7/29/2019 11:40 AM, Corinna Vinschen wrote:
>> On Jul 29 17:23, Corinna Vinschen wrote:
>>> On Jul 29 14:26, Ken Brown wrote:
>>>> On 7/29/2019 9:47 AM, Corinna Vinschen wrote:
>>>>> On Jul 29 13:18, Ken Brown wrote:
>>>>>> $ strace -o trace.out ls -lL <(grep bash .bashrc)
>>>>>> ls: cannot access '/dev/fd/63': No such file or directory
>>>>>
>>>>> No, please run bash:
>>>>>
>>>>>      strace -o trace.out bash -c 'ls -lL <(grep bash .bashrc)'
>>>>>
>>>>> Otherwise there's no process actually creating the pipe, given the <()
>>>>> expression is a bash expression.
>>>>
>>>> Yes, of course.  I should have realized this since it's exactly what I
>>>> did under gdb.  Anyway, the result is the same as it was under gdb: If
>>>> I run the command under strace, I don't see the broken pipe error.
>>>>
>>>> Is it possible that debugging causes an fd to the read end of the pipe
>>>> to stay open longer, thereby preventing the error?
>>>
>>> The fact that you observe it sporadically points to a race condition.
>>> Debugging serializes stuff usually running in parallel, potentially
>>> eliminating the race.
>>
>> Is there any chance this is a BLODA problem?
> 
> I doubt it.  I'm seeing this on two different computers, and I haven't seen any
> other symptoms suggesting BLODA.
> 
>>   If /dev/fd/63 doesn't
>> exist in ls, it would mean ls didn't inherit the FIFO, which sounds
>> very unlikely.
> 
> Actually I never saw an ls error saying /dev/fd/63 doesn't exist, except in my
> incorrect run of strace.
> 
> Here's the error that I can reproduce easily in xterm:
> 
> $ ls <(grep bash .bashrc)
> /dev/fd/63
> grep: write error: Broken pipe
> 
> This happens 98% of the time.  Notice that I used plain 'ls' rather than the
> original 'ls -lL'.  With the latter, I get the broken pipe error 60% of the time
> rather than 98%:
> 
> $ ls -lL <(grep bash .bashrc)
> pr-------- 1 kbrown None 0 2019-07-29 14:46 /dev/fd/63
> grep: write error: Broken pipe
> 
> What about the explanation I tried earlier, but perhaps not clearly: ls prints
> /dev/fd/63 and then exits, thereby closing the read end of the pipe, while grep
> (running asynchronously) hasn't finished writing to the write end of the pipe.
> 
> The fact that I get the broken pipe error more often with plain 'ls' than with
> 'ls -lL' is consistent with that.  And the fact that I get no errors with 'cat
> <(grep bash .bashrc)' is also consistent with it, since cat doesn't exit until
> grep has finished writing.
> 
> On the other hand, this doesn't explain why I see the error only under xterm,
> nor does it explain why you can't reproduce it at all.

I've made some progress.  It turns out that the problem only occurs in terminals 
launched from the xwin-xdg-menu tray icon.  I can even launch a mintty window 
from that icon (System Tools -> Cygwin Terminal) and I'll see the problem.  On 
the other hand, I can launch an xterm without using that icon (e.g., 'DISPLAY=:0 
xterm -l&' from a mintty window) and I won't see the problem.

So the issue has something to do with how xwin-xdg-menu launches applications, 
and how that interacts with bash's process substitution.  I've just downloaded 
the xwin-xdg-menu source and will see if I can figure out what's going on.  I've 
also added Jon to the CC in case he has a chance to take a look.

Ken

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]