Hi Takashi,

On Fri, 4 Apr 2025, Takashi Yano wrote:

> On Fri, 4 Apr 2025 14:13:57 +0200 (CEST)
> Johannes Schindelin wrote:
> > On Fri, 4 Apr 2025, Takashi Yano wrote:
> > > On Fri, 04 Apr 2025 07:27:09 +0200 Johannes Schindelin wrote:
> > >
> > > > Is Jeremy's guess "if raw_write doesn't need to wait (ie, there's room
> > > > in the pipe for the write) it doesn't hit the signal stuff" correct?
> > > > If so, it would be good to add that part to the commit message because
> > > > the commit would otherwise still be incomplete.
> > >
> > > That's not correct. Indeed, raw_write() waits for room in the pipe,
> > > however, it does not matter in this case. The probelm occurs at
> > > cygwait() which waits for pipe mutex as already mentioned in the commit
> > > message.
> >
> > So what is the explanation, then, that this hung only occasionally and not
> > all the time?
>
> As far as I investigated, the event handle signal_arrived was never
> initialized all the time. Therefore, the its value is just copied from
> the parent. The event signal_arrived is not inheritable, so, the handle
> value is basically not a valid one.

But that means that the `signal_arrived` that is copied from the parent
process should be invalidated in the child processes, right?

> However, the handle value of win32 is a small value such as 0x1ac,
> it can easily be the same value with other existing handle.
> I observed two cases, one was the value of signal_arrived was a
> valid handle value but was not the event handle, the other was the
> value was a valid event handle (but not initialize as signal_arrived).
>
> I'm not quite sure why, but most of the cases were one of the above.
> Then sometimes its value is really invalid.

Okay, so basically it is the wrong handle all of the time but sometimes
the function calls still work by some happenstance?

I, too, have observed in the past that `HANDLE` values are reused
relatively quickly, therefore that sounds quite plausible an explanation
to me.

Again, good material for the commit message, so that others do not have to
repeat your analysis in its entirety.

Ciao,
Johannes

Reply via email to