Bug 120462 - strace -f -p on multithreaded program does not notice existing threads
Summary: strace -f -p on multithreaded program does not notice existing threads
Alias: None
Product: Fedora
Classification: Fedora
Component: strace   
(Show other bugs)
Version: 2
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Roland McGrath
QA Contact:
Keywords: FutureFeature
Depends On:
TreeView+ depends on / blocked
Reported: 2004-04-08 23:25 UTC by Hrunting Johnson
Modified: 2007-11-30 22:10 UTC (History)
0 users

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

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2004:338 normal SHIPPED_LIVE Updated strace package 2004-09-01 04:00:00 UTC

Description Hrunting Johnson 2004-04-08 23:25:49 UTC
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):

How reproducible:

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

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 23:56:25 UTC
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-09 00:01:22 UTC
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-09 00:07:54 UTC
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 12:18:55 UTC
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 22:13:24 UTC
I've made this enhancement upstream.

Comment 6 Jay Turner 2004-09-02 03:32:26 UTC
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.


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