Bug 209106 - Ltrace hangs when tracing child process with -f on FC6
Ltrace hangs when tracing child process with -f on FC6
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: ltrace (Show other bugs)
6
powerpc Linux
medium Severity medium
: ---
: ---
Assigned To: Petr Machata
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-10-03 05:39 EDT by IBM Bug Proxy
Modified: 2015-05-04 21:32 EDT (History)
2 users (show)

See Also:
Fixed In Version: 0.5-7.45svn.fc7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-07-11 11:21:41 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)
Combined patch for tracing fork and tracing with pid. (6.80 KB, patch)
2006-10-03 05:39 EDT, IBM Bug Proxy
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
IBM Linux Technology Center 26560 None None None Never

  None (edit)
Description IBM Bug Proxy 2006-10-03 05:39:50 EDT
LTC Owner is: skannery@in.ibm.com
LTC Originator is: yuweiy@cn.ibm.com


Problem description:
Ltrace hangs when trace child process with -f option

Hardware Environment
    Machine type (p650, x235, SF2, etc.):SF4+
    Cpu type (Power4, Power5, IA-64, etc.):Power5+

Please provide access information for the machine if it is available.
ltc3.cn.ibm.com(root/.pasroot)

Is this reproducible?
    If so, how long does it (did it) take to reproduce it?
    Describe the steps:

[root@ltc3 home]# cat trace-fork.c
/* Ltrace Test : trace-fork.c
   Objectives  : Verify that ltrace can trace to child process after
   fork called.

   This file was written by Yao Qi <qiyao@cn.ibm.com>.  */

#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
void
child ()
{
  printf("Fork Child\n");
  sleep(1);
}

int
main ()
{
  pid_t pid;
  pid = fork ();

  if (pid == -1)
    printf("fork failed!\n");
  else if (pid == 0)
    child();
  else
    {
      printf("My child pid is %d\n",pid);
      wait();
    }
  return 0;
}
[root@ltc3 home]# gcc -o trace-fork trace-fork.c
[root@ltc3 home]# ltrace -f ./trace-fork
unexpected breakpoint at 0xffd63e0
_start(1, 0xfe56fa44, 0xfe56fa4c, 0xfe56fac0, 0xffce9a0 <unfinished ...>
__libc_start_main(1, 0xfe56fa44, 0xfe56fa4c, 0xfe56fac0, 0xffce9a0 <unfinished ...>
fork( <unfinished ...>
fork( <unfinished ...>
[pid 12879] --- SIGSTOP (Stopped (signal)) ---
[pid 12878] <... fork resumed> )                                               
                                          = 12879
[pid 12878] printf("My child pid is %d\n", 12879 <unfinished ...>
[pid 12878] fork(My child pid is 12879
)                                                                              
                         = 22
[pid 12878] wait(0x16              -----------> Hang

 
Additional information:
[root@ltc3 home]# rpm -q ltrace
ltrace-0.5-1.0.45svn.5

Analysis: Applied manually the patch given thru bug 24646 for tracing fork. Hang
problem is getting addressed with the patch. But the library calls of the forked
child is not getting traced. This is because the breakpoints for the library
symbols of the child process is not getting inserted properly. Analysing further..

Wei,
  I have prepared a patch for this problem. While patch for tracing fork
provided in bug 24646 addressed the hang issue, I had to make few more
modifications in addition to that patch to address the issue on tracing the
child process.

This patch is prepared over ltrace-0.5-1.0.45svn.5 level. Please verify this
patch and let me know the results.

Still there are some issues like "puts" getting printed instead of "printf",
incorrect data getting printed as parameters for "puts", unexpected breakpoints,
etc. These issues need to be looked at separately. 
Thanks, Supriya

<Test patch-1 part of Consolidated patch>
Testpatch for addressing hang while tracing child


Supriya,
I had tested the patch from above , there is no hang for ltrace while tracing
child, but it cant trace a process by its PID any more.

[root@blade9 ~]# /usr/src/redhat/BUILD/ltrace-0.5/ltrace -f ./trace-fork
unexpected breakpoint at 0xffd63e0
__libc_start_main(1, 0xf8f6faa4, 0xf8f6faac, 0xf8f6fb0c, 0xffce9a0 <unfinished ...>
fork( <unfinished ...>
fork()                                                                         
                 = 13262
[pid 13261] printf("My child pid is %d\n", 13262 <unfinished ...>
[pid 13261] fork(My child pid is 13262
)                                                                               = 22
[pid 13261] wait(0x16 <unfinished ...>
[pid 13262] puts("Fork Child"Fork Child
)                                                                   = 11
[pid 13262] sleep(1 <unfinished ...>
[pid 13262]
puts("\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377"...)
= 0
[pid 13262] +++ exited (status 0) +++
--- SIGCHLD (Child exited) ---
<... wait resumed> )                                                           
                 = -1
+++ exited (status 0) +++


[root@blade9 ~]# ./attach-process &
[1] 13270
[root@blade9 ~]# /usr/src/redhat/BUILD/ltrace-0.5/ltrace -p 13270
[root@blade9 ~]#
[1]+  Done                    ./attach-process
[root@blade9 ~]#


Wei,
  Can you pls apply this patch (trace_pid_patch) in addition to the previous one
and verify whether tracing a pid is working.
Thanks, Supriya

<Test patch-2 part of Consolidated patch>
Test patch for tracing pid


Tested ltrace with the patch-1 and patch-2, and it works fine for tracing
process by pid, and the same result for tracing child as comment earlier.

[root@blade9 ~]# ./attach-process &
[1] 15622
[root@blade9 ~]# /usr/src/redhat/BUILD/ltrace-0.5/ltrace -p 15622
sleep(3)                                                                       
                 = 0
+++ exited (status 0) +++
[1]+  Done                    ./attach-process
[root@blade9 ~]#
Comment 1 IBM Bug Proxy 2006-10-03 05:39:50 EDT
Created attachment 137634 [details]
Combined patch for tracing fork and tracing with pid.
Comment 2 IBM Bug Proxy 2006-10-07 23:50:49 EDT
----- Additional Comments From yuweiy@cn.ibm.com  2006-10-07 23:46 EDT -------
Tested the combined patch, it works fine.

[root@blade9 ~]# /usr/src/redhat/BUILD/ltrace-0.5/ltrace ./trace-fork
unexpected breakpoint at 0xffd63e0
__libc_start_main(1, 0xf82efad4, 0xf82efadc, 0xf82efb38, 0xffce9a0 <unfinished ...>
fork( <unfinished ...>
fork(Fork Child
My child pid is 32390
 <unfinished ...>
wait(0x16 <unfinished ...>
--- SIGCHLD (Child exited) ---
<... wait resumed> )                                                           
                 = -1
+++ exited (status 0) +++

[root@blade9 ~]# /usr/src/redhat/BUILD/ltrace-0.5/ltrace -f ./trace-fork
unexpected breakpoint at 0xffd63e0
__libc_start_main(1, 0xff19fad4, 0xff19fadc, 0xff19fb38, 0xffce9a0 <unfinished ...>
fork( <unfinished ...>
fork()                                                                         
                 = 3580
[pid 3574] printf("My child pid is %d
", 3580 <unfinished ...>
[pid 3574] fork(My child pid is 3580
)                                                                              
 = 21
[pid 3574] wait(0x15 <unfinished ...>
[pid 3580] puts("Fork Child"Fork Child
)                                                                    = 11
[pid 3580] sleep(1 <unfinished ...>
[pid 3580]
puts("377377377377377377377377377377377377377377377377377377377377377377377377377377377377377377377377"...)
= 0
[pid 3580] +++ exited (status 0) +++
--- SIGCHLD (Child exited) ---
<... wait resumed> )                                                           
                 = -1
+++ exited (status 0) +++


[root@blade9 ~]# ./attach-process &
[1] 13830
[root@blade9 ~]# /usr/src/redhat/BUILD/ltrace-0.5/ltrace -p 13830
sleep(3)                                                                       
                 = 0
+++ exited (status 0) +++
[1]+  Done                    ./attach-process
[root@blade9 ~]# 
Comment 3 Matthew Miller 2007-04-06 13:30:58 EDT
Fedora Core 5 and Fedora Core 6 are, as we're sure you've noticed, no longer
test releases. We're cleaning up the bug database and making sure important bug
reports filed against these test releases don't get lost. It would be helpful if
you could test this issue with a released version of Fedora or with the latest
development / test release. Thanks for your help and for your patience.

[This is a bulk message for all open FC5/FC6 test release bugs. I'm adding
myself to the CC list for each bug, so I'll see any comments you make after this
and do my best to make sure every issue gets proper attention.]
Comment 4 Petr Machata 2007-05-24 10:11:59 EDT
Retargetting the bug to FC6.  Fix available in Fedora raw hide, will push it as
update for F-7.
Comment 5 Fedora Update System 2007-07-11 11:21:37 EDT
ltrace-0.5-7.45svn.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.

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