X-Recipient: archive-cygwin@delorie.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:subject:to:references:from:message-id:date
	:mime-version:in-reply-to:content-type
	:content-transfer-encoding; q=dns; s=default; b=YxYrcLa/vJflewBC
	cechFsZoolblIS6f3HvgqvVfxerg9IgFSOK/jcTxY4Jtfgkxqd3p/PEQJkfq0XBg
	viULvcqGMuKNH2K0UkMEdO/mOBfkagZAh2JMnX/xMJwYgw8a35vxN0gH1v4a7rTt
	GC+r5PdR596KMmWEFtHcTMZWkcU=
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:subject:to:references:from:message-id:date
	:mime-version:in-reply-to:content-type
	:content-transfer-encoding; s=default; bh=X5sRV/wG4+LiUfCz7kvxLL
	5rcP0=; b=ZauG12Wg6/nrPvEmVa48QBaf3mhH/OmFoO0OOa9WUy6aoN+WatSDp4
	EZG67NLHEYMdIJ/Ixq6mpLF6Jjj0AMvlJV/oYLXhOXdZf6eW+LgJFnvZNojQxAoy
	kwFWpIPd0yDMuNeaGxesjkDA2X7E65n5Wg93Aox6hqKtxay/UoTYc=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=H*r:8.12.11, H*UA:Firefox, awaiting
X-HELO: m0.truegem.net
Subject: Re: long I/O delays when strace is running
To: cygwin@cygwin.com
References: <be8713ec-5b68-e0e9-c5a5-d48fce491a2d@pobox.com> <91DCAC3CB99C724EB365BB64677FBE7B16EBBD@MX204CL04.corp.emc.com> <46e39bce-9782-5c74-c196-35ee97ebbc64@pobox.com> <ace81c86-80d5-bef9-6b93-7d36dde5a4e8@pobox.com> <bff9c5ea-85d9-bf4e-2f25-271c1490565f@pobox.com> <58F9D314.2000100@maxrnd.com> <7d56e728-32a3-9179-b002-e83880e297d0@pobox.com>
From: Mark Geisert <mark@maxrnd.com>
Message-ID: <58FA83DB.3000209@maxrnd.com>
Date: Fri, 21 Apr 2017 15:12:43 -0700
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0 SeaMonkey/2.40
MIME-Version: 1.0
In-Reply-To: <7d56e728-32a3-9179-b002-e83880e297d0@pobox.com>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit

Daniel Santos wrote:
> Thanks for the help Mark.  My current suspicion is that the _pinfo isn't getting
> initialized when the process is exec-ed by strace, but I haven't proved that.  I
> added a dump() member function to _pinfo, but it crashes and I can't seem to
> debug that in gdb (it makes a stacktrace file instead of letting me debug).  So
> the cygpid.<n> shared object is there, but I'm suspecting that it's either all
> zeros or just not fully initialized -- and this is for the pid of the strace
> process.  So for each strace process, there's a 2-3 second delay when trying to
> read the process list.

Re debugging strace itself, you may not realize that strace is not a 
Cygwin-native program.  It's a Windows-native program.  So debugging it with 
Cygwin gdb is problematic.

I can tell you roughly how strace operates.  It launches the target program with 
CreateProcess(), not with exec().  It acts as the debugger of the target in 
order to receive Windows DEBUG_EVENTs for things like DLL loads, thread 
creation, etc. etc.  The Cygwin DLL in the target can tell when it's being run 
under strace and generates trace lines with OutputDebugString() calls that 
strace receives as DEBUG_EVENTs.  strace then just outputs the trace line.

strace does have to explicitly ContinueDebugEvent() on each DEBUG_EVENT it 
receives, and if there's some issue with that then the target program will 
remain suspended awaiting that continue.  I've never seen an issue with this but 
it's another possible place to look, I suppose.

Why strace appears to interact badly with /proc accesses, I have no idea.

..mark


--
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

