public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Daniel Santos <daniel.santos@pobox.com>
To: cygwin@cygwin.com
Subject: Re: long I/O delays when strace is running
Date: Mon, 24 Apr 2017 09:24:00 -0000	[thread overview]
Message-ID: <00fb01d0-acdc-68da-e31e-45ffa7099043@pobox.com> (raw)
In-Reply-To: <58FC5AFB.3010903@maxrnd.com>

Well, waiting for GNU/Linux tests to run, so I had a little more time to 
play with this.

On 04/23/2017 02:42 AM, Mark Geisert wrote:
> Daniel Santos wrote:
>> Well thank you, I wish I had read this earlier. I've been trying to 
>> debug (with
>> gdb) strace (following children) and now I know why the debugger is 
>> blowing
>> through breakpoints, because I may be debugging strace, but strace 
>> debugging
>> it's own child.  I added a _pinfo::dump () member function that I'm 
>> calling from
>> pinfo::init () after the test "if (!created && !(flag & PID_NEW))" 
>> and it's
>> crashing because for some processes, the entire _pinfo struct isn't 
>> mapped in,
>> just the first page.  Of course, I'm a newbie in this sphere, so 
>> maybe I've
>> missed something and there's sometimes a reason for this?  (The first 
>> part of
>> the struct looks normal.) Otherwise, that would be another odd flaw.
>
> I don't know enough about pinfo.h and pinfo.cc to say anything 
> definite on this.

Well here's one mystery solved.  I modified my dump() function to first 
dump the first page of the struct and then the second, so that when it 
crashes I can see the contents of the first page at least:

_pinfo 0x30000 {
   pid 2044,
   process_state 0x00004001,
   ppid 2044,
   exitcode 0
   cygstarted 0,
   dwProcessId 0x00000000,
   progname "",

The process_state's bit 0x00004000 happens to be PID_EXECED, so this is 
intentionally shorter because there's no more information.

As for the strange _pinfo object that causes the delay, this appears to 
be an error in the process database because the windows PID is a 
duplicate of another process entry. (I modified ps.exe to output the 
_pinfo::process_state field.)

$ strace --trace-children --output=/tmp/ps.log --mask=all ps -el
       PID    PPID    PGID     WINPID   TTY         UID STIME  STATE   
COMMAND
       948    1788     948       1772  pty0      197608 00:04:22 
000000c1 /usr/bin/bash
      2720       1    2720       2720  ?             18 00:02:42 
00000041 /usr/bin/cygrunsrv
       860       0       0        860  pty0           0 00:04:30 
00000001 /usr/bin/cygrunsrv
       984       1    2168        984  pty0      197608 00:04:30 
00000041 /usr/bin/ps
      2376    1628    2376       2612  ?         197610 00:02:45 
000000c1 /usr/sbin/sshd
      2524    2720    2524       1404  ?             18 00:02:42 
000000c1 /usr/sbin/cygserver
      2168     948    2168        860  pty0      197608 00:04:30 
00000061 /usr/bin/strace
      1788    2376    1788       2788  ?         197610 00:04:22 
000000c1 /usr/sbin/sshd
      1628       1    1628       1628  ?         197610 00:02:45 
00000041 /usr/bin/cygrunsrv

The entry that causes the delay is the one with a zero PPID and PGID and 
the progname field is wrong --  It isn't "cygrunsrv".  It always has the 
same progname name of the previous process.  Notice that the WINPID 
field has the same value as the PID of the strace process that's real 
(2168).

So my guess is that this object shouldn't even be there.

Daniel

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

  parent reply	other threads:[~2017-04-24  5:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-20 18:13 Daniel Santos
2017-04-21  0:11 ` Gluszczak, Glenn
2017-04-21  7:57   ` Daniel Santos
2017-04-21  9:38     ` Daniel Santos
2017-04-21 11:06       ` Daniel Santos
2017-04-21 12:08         ` Mark Geisert
2017-04-21 18:23           ` Daniel Santos
2017-04-22 15:24             ` Mark Geisert
2017-04-23 12:58               ` Daniel Santos
2017-04-23 18:15                 ` Mark Geisert
2017-04-24  8:23                   ` Daniel Santos
2017-04-24  9:24                   ` Daniel Santos [this message]
2017-04-24  9:34                     ` Mark Geisert
2017-04-24 15:00                       ` Daniel Santos
2017-04-24 19:30                       ` Daniel Santos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=00fb01d0-acdc-68da-e31e-45ffa7099043@pobox.com \
    --to=daniel.santos@pobox.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).