Bug 120462 - strace -f -p on multithreaded program does not notice existing threads
strace -f -p on multithreaded program does not notice existing threads
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: strace (Show other bugs)
2
All Linux
medium Severity medium
: ---
: ---
Assigned To: Roland McGrath
: FutureFeature
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-04-08 19:25 EDT by Hrunting Johnson
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-04-16 19:27:27 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Hrunting Johnson 2004-04-08 19:25:49 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6)
Gecko/20040206 Firefox/0.8

Description of problem:
strace cannot trace multithreaded programs.  It will only trace the
parent thread, which is often not a thread doing any real work. 
strace is basically useless on multithreaded programs.

Version-Release number of selected component (if applicable):
strace-4.5.1-1

How reproducible:
Always

Steps to Reproduce:
1.start multithreaded process
2.strace it
3.
    

Actual Results:  Only trace from parent thread is shown.

Expected Results:  Either strace needs a way to trace individual
threads or it should show all of the switching between threads.

Additional info:

I have no clue how this would work.  It's only a problem with NPTL
programs that have the same PID for every thread.  There is no
workaround, but I see no easy solution, either.
Comment 1 Roland McGrath 2004-04-08 19:56:25 EDT
Are you using -f?  If you are using strace -f and not seeing all
threads, for both NPTL and linuxthreads flavors, then please report a
specific test scenario with all necessary sources.
Comment 2 Hrunting Johnson 2004-04-08 20:01:22 EDT
Yes, I am.  The specific multi-threaded program I'm trying to strace
is called Cyclone
(http://archive.highwinds-software.com/builds/index.html).  The
software is proprietary, but the evaluation license is free.  When I
do an strace -f -p <pid>, all I get is the result of the primary
process.  I know the process is doing more because it's pushing out
over 100Mbps of traffic.
Comment 3 Roland McGrath 2004-04-08 20:07:54 EDT
It is important to include in any bug report all the details of how
you are using the program.  You did not say you were using -p to
attach to a running program, which is a critical detail.

strace -f attaches to new threads as they are created.  When using -p,
you are still only attaching to one thread (the initial thread) and if
you use -f then you also see new threads created once you are already
tracing.  strace -p has never before attached to several threads
automatically, for either NPTL or linuxthreads.  It is now easy enough
to implement that for NPTL threads due to 2.6 kernel support in /proc.
That seems like a worthwhile enhancement, but lack of it is not really
a bug as such.  I will implement this upstream, and a new strace rpm
might make it in before the FC2 release. 
Comment 4 Hrunting Johnson 2004-04-09 08:18:55 EDT
Well, right.  The problem was before that you could do strace -f -p on
an individual thread because threads got their own PIDs so there
wasn't any need to be able to trace from the master, but I should've
filed a better bug report.

Thanks for grabbing it.
Comment 5 Roland McGrath 2004-04-16 18:13:24 EDT
I've made this enhancement upstream.
Comment 6 Jay Turner 2004-09-01 23:32:26 EDT
An errata has been issued which should help the problem 
described in this bug report. This report is therefore being 
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files, 
please follow the link below. You may reopen this bug report 
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2004-338.html

Note You need to log in before you can comment on or make changes to this bug.