public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "agentzh at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug dyninst/23513] New: Dyninst runtime kills the target process when attaching to the target process for a second time
Date: Sat, 11 Aug 2018 00:34:00 -0000	[thread overview]
Message-ID: <bug-23513-6586@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=23513

            Bug ID: 23513
           Summary: Dyninst runtime kills the target process when
                    attaching to the target process for a second time
           Product: systemtap
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: dyninst
          Assignee: systemtap at sourceware dot org
          Reporter: agentzh at gmail dot com
  Target Milestone: ---

Created attachment 11178
  --> https://sourceware.org/bugzilla/attachment.cgi?id=11178&action=edit
stap-report output on the same box

Consider the following simple forever-running C program:

```C
#include <unistd.h>

int main(void) {
    while (1) {
        usleep (1000);
    }
    return 0;
}
```

Compile it and generate `./a.out`:

```
gcc -g -Wall a.c
```

Then start it in one terminal (let's call it terminal A):

```
$ ./a.out
```

It hangs as expected.

Then try running the stap dyninst command like below in another terminal (let's
say, terminal B):

```
$ /opt/stap/bin/stap -e 'probe process("/lib64/libc.so.6").function("usleep") {
println("hi") exit() }' -x `pgrep -f './a.out'` --dyninst
hi
```

It works as expected. And in terminal A, the `./a.out` program is still
running. So far so good.

But now as soon as we run the `stap` command above again, we got the following
error on terminal B:

```
$ /opt/stap/bin/stap -e 'probe process("/lib64/libc.so.6").function("usleep") {
println("hi") exit() }' -x `pgrep -f './a.out'` --dyninst
--FATAL-- #68: Dyninst was unable to attach to the specified process
--FATAL-- #68: BPatch.C[1047]: no process 40758 defined in procsByPid

stapdyn: ERROR: Couldn't attach to the target process
WARNING: /opt/stap/bin/stapdyn exited with status: 1
Pass 5: run failed.  [man error::pass5]
```

And in terminal A, the `./a.out` process is already killed too:

```
agentzh@work2 ~ $ ./a.out
Killed
```

This can also be reproduced by a `probe begin` one-liner:

```
agentzh@work2 ~ $ /opt/stap/bin/stap -e 'probe begin { println("hi") exit() }'
-x `pgrep -f './a.out'` --dyninst
hi

agentzh@work2 ~ $ /opt/stap/bin/stap -e 'probe begin { println("hi") exit() }'
-x `pgrep -f './a.out'` --dyninst
--FATAL-- #68: Dyninst was unable to attach to the specified process
--FATAL-- #68: BPatch.C[1047]: no process 40816 defined in procsByPid

stapdyn: ERROR: Couldn't attach to the target process
WARNING: /opt/stap/bin/stapdyn exited with status: 1
Pass 5: run failed.  [man error::pass5]
```

I'm using the 3.3 release tag of systemtap on Fedora 27 x86_64:

```
$ /opt/stap/bin/stap --version
Systemtap translator/driver (version 3.3/0.173, commit
release-3.3-0-g48867d1cface)
Copyright (C) 2005-2018 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
tested kernel versions: 2.6.18 ... 4.18-rc0
enabled features: BOOST_STRING_REF DYNINST BPF NLS NSS
```

Also attached the stap-report output for the same box.

Am I doing anything wrong here?

-- 
You are receiving this mail because:
You are the assignee for the bug.

             reply	other threads:[~2018-08-11  0:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-11  0:34 agentzh at gmail dot com [this message]
2018-08-11  0:39 ` [Bug dyninst/23513] " fche at redhat dot com
2018-08-11  0:46 ` agentzh at gmail dot com
2019-04-05 19:07 ` scox at redhat dot com
2019-04-06  1:01 ` scox at redhat dot com
2019-04-10 12:42 ` scox at redhat dot com
2019-12-11 16:25 ` avi@cloudius-systems.com

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=bug-23513-6586@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=systemtap@sourceware.org \
    /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).