Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perl debugger can't breakpoint single thread after children stop #13027

Open
p5pRT opened this issue Jun 15, 2013 · 1 comment
Open

perl debugger can't breakpoint single thread after children stop #13027

p5pRT opened this issue Jun 15, 2013 · 1 comment

Comments

@p5pRT
Copy link

p5pRT commented Jun 15, 2013

Migrated from rt.perl.org#118487 (status was 'new')

Searchable as RT118487$

@p5pRT
Copy link
Author

p5pRT commented Jun 15, 2013

From perl-diddler@tlinx.org

Created by perl-diddler@tlinx.org

Have program that sorts rpms (~20K at a shot) looking for
old versions in the same dir (I update a download cache of rpms
from my distro with new rpms, and then get rid of the old ones).

To do this I need to query each rpm file on disk to find out what it
thinks its Name-Version and Revision are. (If it was just sorting names
I wouldn't bother with splitting up the work). So a momma process
spawns off a daughter process who spawns off 9 workers -- while
momma goes and waits for output. The sorted lists come back, momma
concatenates them together and does a final pass through the list
to catch any rpms that didn't get compared at the list boundaries.

She ends up with a delete list and a keep list. The delete list
I've been putting off in a .recycle dir in the root of the volume.
I was using cp as I wanted to keep the directory structure of things
put in the recycle bin and was too lazy when I first wrote this to
do that part myself in perl.

I've been mostly using print statement to debug, but decided to
try the debugger -- breaking at the point the momma process
has all the lists merged, and is calling the recycle bin creation
routine. At this point there is only 1 process... all the children
ended a few-several seconds before.

The debugger can't debug what is now my single threaded process
because it put in it's own traps and noticed the children as they
exited and said​:
Read 17831 rpm names.
Use 9 procs w/1983 items/process
Debugged program terminated. Use q to quit or R to restart,
use o inhibit_exit to avoid stopping after program termination,
h q, h R or h o to get additional info.
######### Forked, but do not know how to create a new TTY. #########
  Since two debuggers fight for the same TTY, input is severely entangled.

  I know how to switch the output to a different window in xterms, OS/2
  consoles, and Mac OS X Terminal.app only. For a manual switch, put the name
  of the created TTY in $DB​::fork_TTY, or define a function
  DB​::get_fork_TTY() returning this.

  On UNIX-like systems one can get the name of a TTY for the given window
  by typing tty, and disconnect the shell from TTY by sleep 1000000.

[pid=91229->91256] DB<34> Debugged program terminated. Use q to quit or R to restart,
use o inhibit_exit to avoid stopping after program termination,
h q, h R or h o to get additional info.
######### Forked, but do not know how to create a new TTY. #########
  Since two debuggers fight for the same TTY, input is severely entangled.

  I know how to switch the output to a different window in xterms, OS/2
  consoles, and Mac OS X Terminal.app only. For a manual switch, put the name
  of the created TTY in $DB​::fork_TTY, or define a function
  DB​::get_fork_TTY() returning this.

  On UNIX-like systems one can get the name of a TTY for the given window
  by typing tty, and disconnect the shell from TTY by sleep 1000000.

[pid=91229->91246] DB<34> Debugged program terminated. Use q to quit or R to restart,
use o inhibit_exit to avoid stopping after program termination,
h q, h R or h o to get additional info.
######### Forked, but do not know how to create a new TTY. #########
  Since two debuggers fight for the same TTY, input is severely entangled.

  I know how to switch the output to a different window in xterms, OS/2
  consoles, and Mac OS X Terminal.app only. For a manual switch, put the name
  of the created TTY in $DB​::fork_TTY, or define a function
  DB​::get_fork_TTY() returning this.

  On UNIX-like systems one can get the name of a TTY for the given window
  by typing tty, and disconnect the shell from TTY by sleep 1000000.
(...about 10 messages, one for each worker and 1 for the daughter).

All of them have ended where I placed the breakpoint. There is no contention
for input -- the debugger has gotten itself turned inside out and doesn't
want to respond to input now. My program does not ask for input at any time,
so there's nothing competing for input with the debugger -- bug it's still
way confused. I just wanted it to breakpoint well after all the multi
processing stuff was done -- and single step through a single process...
but seems like it got more than a little confused. I didn't start the debugger with any multi-thread options as I wasn't debugging any threads (or multiple
processes) -- just wanted to single step in the end game.

So how do I get the debugger to only pay attention to what's going on
when it reaches the breakpoint? (and not when children exit). Since
each child's STDOUT is going to a pipe on the mom (not a STDIO pipe)
if the debugger interfers, I can get corrupt output -- but dunno, since
the debugger just goes out to lunch.

I can submit the program that does the sorting..... either the working
one that uses cp, or the other , yet to be working that stops (hits
an exit, I put in until I can verify its doing the right thing.. --
it was moving all the files into the root of the recycle bin
(i.e. /mount/.recycle/xxx) and wanted to stop it doing that until
I was sure it had the correct arguments and was going to move the files
into the correct directory.

I can't say for sure, but progs that spawn several workers seem like
they will become more common -- but in this case I asked the debugger
to stop after the multiple cpu part and only wanted it to do a single
process... which it couldn't do. Did I explain that understandably?

Lemme know if you want one of my progs to test this, or if you would find
it just as good to use one of your own...?

Thanks,
-l

Perl Info

Flags:
    category=core
    severity=medium

This perlbug was built using Perl 5.16.2 - Fri Feb 15 01:17:37 UTC 2013
It is being executed now by  Perl 5.16.2 - Fri Feb 15 01:12:05 UTC 2013.

Site configuration information for perl 5.16.2:

Configured by abuild at Fri Feb 15 01:12:05 UTC 2013.

Summary of my perl5 (revision 5 version 16 subversion 2) configuration:
   
  Platform:
    osname=linux, osvers=3.4.6-2.10-default, archname=x86_64-linux-thread-multi
    uname='linux build34 3.4.6-2.10-default #1 smp thu jul 26 09:36:26 utc 2012 (641c197) x86_64 x86_64 x86_64 gnulinux '
    config_args='-ds -e -Dprefix=/usr -Dvendorprefix=/usr -Dinstallusrbinperl -Dusethreads -Di_db -Di_dbm -Di_ndbm -Di_gdbm -Dd_dbm_open -Duseshrplib=true -Doptimize=-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -Wall -pipe -Accflags=-DPERL_USE_SAFE_PUTENV -Dotherlibdirs=/usr/lib/perl5/site_perl'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -fstack-protector -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -Wall -pipe',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -fstack-protector'
    ccversion='', gccversion='4.7.2 20130108 [gcc-4_7-branch revision 195012]', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib64 -fstack-protector'
    libpth=/lib64 /usr/lib64 /usr/local/lib64
    libs=-lm -ldl -lcrypt -lpthread
    perllibs=-lm -ldl -lcrypt -lpthread
    libc=/lib64/libc-2.17.so, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.17'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib/perl5/5.16.2/x86_64-linux-thread-multi/CORE'
    cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib64 -fstack-protector'

Locally applied patches:
    


@INC for perl 5.16.2:
    /home/law/bin/lib
    /usr/lib/perl5/site_perl/5.16.2/x86_64-linux-thread-multi
    /usr/lib/perl5/site_perl/5.16.2
    /usr/lib/perl5/vendor_perl/5.16.2/x86_64-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.16.2
    /usr/lib/perl5/5.16.2/x86_64-linux-thread-multi
    /usr/lib/perl5/5.16.2
    /usr/lib/perl5/site_perl/5.16.2/x86_64-linux-thread-multi
    /usr/lib/perl5/site_perl/5.16.2
    /usr/lib/perl5/site_perl
    .


Environment for perl 5.16.2:
    HOME=/home/law
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LC_COLLATE=C
    LC_CTYPE=en_US.UTF-8
    LD_LIBRARY_PATH=/usr/lib64/mpi/gcc/openmpi/lib64
    LOGDIR (unset)
    PATH=.:/home/law/bin/lib:/sbin:/usr/local/sbin:/usr/lib64/mpi/gcc/openmpi/bin:/home/law/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/lib/qt3/bin:/opt/dell/srvadmin/bin:/usr/sbin:/etc/local/func_lib:/home/law/lib
    PERL5OPT=-CSA -I/home/law/bin/lib
    PERL_BADLANG (unset)
    SHELL=/bin/bash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants