delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/03/15/10:11:02

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:reply-to:in-reply-to:references
:from:date:message-id:subject:to:content-type; q=dns; s=default; b=
o6aAV/vzZBsXmSJV04Be+4ukjFlMxuBqrwTyneuq5xgKcw0pf3aCINyNe5mn0+Ec
6+Z6smKBxP4ku4+clUiUxNct67DvKzuVOjPQkbI23zXp0NwQ+2SugGQtRpx/bNYw
OBI0GRuFCZiJqKLs3On8etHAuT3VpMV82hN5JuSTugk=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:reply-to:in-reply-to:references
:from:date:message-id:subject:to:content-type; s=default; bh=idi
jxN3heE1xDeFiIrMYKdA/XFo=; b=reVEvT20GjW8r5Mdb2e91+yaGjjhPvDGKDV
Jtrs2uacJSDOnqtDD1LHENEhEr29IBWUsNoj9Yj1ZG+o6XVRYF1p89Yx6ti9NbOV
fFWaShpWRWms9o/by7xfWuoQp/ewf+A61rkvEWRF25MGoj7Cgd9G1p53bBzhfCTP
1R4Lsgk4=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=4.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,LIKELY_SPAM_BODY,RCVD_IN_DNSWL_LOW,SPAM_URI,SPF_PASS autolearn=no version=3.3.2 spammy=Hong, wine, Hx-languages-length:2332, Qian
X-HELO: mail-wm0-f42.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:in-reply-to:references :from:date:message-id:subject:to; bh=qwr6tlHqZ5kbHWlAu0PXmulXef1Lm8EIC4hUvpTh2YE=; b=ejJyA9jTFHfbDty+2tVr8+6n/h+vz3InutJV1QYSZUoEdji6/W71LMOR5+jUnXh/0Q kKmS63irLBJAcceTXm68tlLMkeJ7BvE/ALJIaqLw2GATc1csm5ZyzWk7QklXbbs3VzUI 33vt5mJfakbi2tn4jHEDR6hgMlU8noNb34YVJj1a9eXf/AS3rQlzeOtv2QapnRQZlTO0 7OHZ5+AF9Eh7XgP7oQLRPh/nKRZoQHUZD8ljvMrdUFCgOIyrKSbDynfEJyRFr4JIIyuC aRLRv/vxmJ6JS5k2QOThbDd3Dv0N9ldKgPoKm8SUu8iNmKr5/zixMXFVvV/RGOyW2v6D 8tOQ==
X-Gm-Message-State: AD7BkJLbGR4t+JTlCpZJ0p7NiKZX6/Qs6N/pDUZvO4WqbRZPwZQewVMKzJgf9a7TuILOMC89RjdVLMwMCdD6jA==
X-Received: by 10.194.78.37 with SMTP id y5mr30304165wjw.78.1458051017476; Tue, 15 Mar 2016 07:10:17 -0700 (PDT)
MIME-Version: 1.0
Reply-To: fracting AT gmail DOT com
In-Reply-To: <20151102143023.GC963@calimero.vinschen.de>
References: <CALd+sZS-EbkUMgmRCyJUK0LCMo6zydzB1rbM9iZFrAcnbfHCRQ AT mail DOT gmail DOT com> <CALd+sZTRVMuLjwZMjxN6f6JvTtax5rJAUuk_SMXvcQzMzxhirA AT mail DOT gmail DOT com> <20151102143023 DOT GC963 AT calimero DOT vinschen DOT de>
From: Qian Hong <fracting AT gmail DOT com>
Date: Tue, 15 Mar 2016 22:09:36 +0800
Message-ID: <CALd+sZSKDjiUBEN0oBvXe2C+XJE=run9C74OGzQ7bHFYcsxNjg@mail.gmail.com>
Subject: Re: Randomly hang when compiling Cygwin on Cygwin on Wine
To: cygwin <cygwin AT cygwin DOT com>
X-IsSubscribed: yes

On Mon, Nov 2, 2015 at 10:30 PM, Corinna Vinschen
<corinna-cygwin AT cygwin DOT com> wrote:
> I don't answer this question conclusively before consulting my lawyer.

Me too, but my lawyer was much more slower, his name is Mr. Flash [1]. ;)

> It *might* be possible.  See fhandler_base_overlapped::close(),
> fhandler_base_overlapped::check_later() and flush_async_io(), all three
> in fhandler.cc.

Thanks a lot, your information helps a lot.

The bug is hard, it takes a lot of time to reproduce, but finally we got it!

It is a race condition in the Wine side:

Firstly, the reader process calls NtReadFile(), in Wine's
implementation, NtReadFile() tries to read some data using
read_unix_fd() first, if there is enough data needed it will returns
STATUS_SUCCESS immediately, if no enough data available it will
register an async read service using register_async() and returns
STATUS_PENDING. Ideally this async service will either get some data
and wake up the reader process if more data coming form writer, or get
nothing but wake up the reader process telling the pipe is broken if
the writer close the pipe.

However, unfortunately, in some very rare case, the writer process
close the writer handle at a very special time point, a little bit
later then read_unix_fd() but a little bit sooner than
register_async(), as a result, the async read service in the reader
side has no chance to be noticed about closing of writer any more
because it is already closed.

That's why the reader process waits forever on the async overlapped event.

The solution we worked out is: If the writer is closed, then the
reader register_async() should fail with STATUS_PIPE_BROKEN
immediately, so the reader won't try to call WaitForSingleObject on
the async overlapped event at all.


Patch from Sebastian Lackner:
Subject: server: Do not allow to queue async operation for broken pipes.
https://github.com/wine-compholio/wine-staging/commit/7b40b6922a0c7a93ff62b69dd2b3c2a6076be851

We've tested this patches for a couple of weeks, and it has been
confirmed working, gcc compiles more than 64 times without any
hanging!

I'm happy to close this thread, next goal will be other Wine+Cygwin bugs... :)

[1] http://disney.wikia.com/wiki/Flash

-- 
Regards,
Qian Hong

-
http://www.winehq.org

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019