Bug 58070

Summary: left over zombie processes after debugging
Product: [Applications] kdevelop Reporter: Daniel Franke <franke.daniel>
Component: CPP DebuggerAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: savoiu
Priority: NOR    
Version: 3.0.0a4   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Solaris   
Latest Commit: Version Fixed In:

Description Daniel Franke 2003-05-03 19:02:49 UTC
Version:           3.0.0a4 (using KDE 3.1.1)
Installed from:    compiled sources
Compiler:          gcc version 3.2.2
OS:          SunOS (sun4u) release 5.8

This is somewhat fuzzy, but I hope you can make sense out of it:

Steps:
 1. Create a new project, say "Simple hello world program" in C
 2. add a breakpoint at "printf()" line
 3. `ps -ef | grep defunct` -> 0 lines
 4. start debugging ( '>' button)
 5. stop debugging at breakpoint ('x' button)
 6. `ps -ef | grep defunct` -> 0 lines
 7. start debugging ( '>' button)
 8. stop debugging at breakpoint ('x' button)
 9. `ps -ef | grep defunct` -> 1 lineps -ef | grep 13258
  franke 13258 12436  1 18:50:12 ?        0:08 gideon -caption KDevelop 3.0 -icon kdevelop -miniicon kdevelop
  franke 13281  6867  0 18:51:56 pts/5    0:00 grep 13258
  franke 13274 13258  0                        0:01 <defunct>

From now, each debugging start/stop adds another zombie (paren: gideon)
Later trying to (re-)compile the project never ends (maybe a waitpid() or similar?)

Workaround: close and restart gideon.

> gdb -v
GNU gdb 5.0
Copyright 2000 Free Software Foundation, Inc.
This GDB was configured as "sparc-sun-solaris2.8".

> g++ -v
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/3.2.2/specs
Configured with: ../configure --disable-nls --with-ld=/usr/ccs/bin/ld --with-as=/usr/ccs/bin/as
Thread model: posix
gcc version 3.2.2
Comment 1 Jens Dagerbo 2003-05-04 03:26:34 UTC
I do not see this problem, running Gentoo Linux. 
 
GNU gdb 5.3  
This GDB was configured as "i686-pc-linux-gnu" 
 
gcc version 3.2.2 
Comment 2 John Birch 2003-05-15 03:45:45 UTC
I also don't have this behaviour. 
 
Could you try with the latest cvs version of gideon and with gdb 5.3. 
 
I'm not sure what we could do here as it may well be something to do with the SunOS which I 
don't have. 
 
I'm closing this bug with resolution of WONTFIX but that's only because it isn't FIXED and no 
other status applies :( 
 
Please reopen if gdb 5.3 and current cvs don't fix the problem for you. (We'll need your help to 
fix this, if that is the case) 
 
Comment 3 Daniel Franke 2003-05-15 11:02:34 UTC
Subject: RE:  left over zombie processes after debugging         

> Could you try with the latest cvs version of gideon and with gdb 5.3. 
I'll give it a try as soon as possible :)

Comment 4 Daniel Franke 2003-05-15 12:03:07 UTC
I got the same behaviour as described above using gdb 5.3 (build from sources, 
configured without any options, path to gdb-5.3 set in project options->debugger) 
 
franke@blade1:~>bin/gdb -v 
GNU gdb 5.3 
[...] 
This GDB was configured as "sparc-sun-solaris2.8". 
 
Additional comment: 
I also get those zombies when "debugging" by mistake, e.g starting debugging 
without having run "Automake & friends" or "configure" (so no executable around). 
This happens using either gdb 5.0 or 5.3 
 
Should I try the same using CVS source (I'm still using 3alpha4) ? 
 
Comment 5 Daniel Franke 2003-05-17 16:24:11 UTC
Latest results using CVS sources:  
 - Build gideon (debug enabled) 
 - run from command prompt 
 - created new project (C hello world) 
 - run debugger (without any executable, even without "Automake & Friends") 
 
console output after starting/stopping debugger three times (result: again two zombie 
processes): 
--- cut --- 
kdevelop (debugger): Debugger state: P: 
kdevelop (debugger): 
kdevelop (debugger): STDERR: /home/franke/devel/zombie/src/zombie: No such file 
or directory. 
Comment 6 Daniel Franke 2003-12-13 00:56:52 UTC
This bug is still valid in 3.0b2 (CVS 031210).
Comment 7 Daniel Franke 2004-01-12 21:25:33 UTC
CVS 04/01/12:
Still the same behaviour as described above, but here are some messages I wasn't aware of before - meaningful?

1. Start debugger ('>' icon)
2. Stop debugger ('x' icon)

--
ld.so.1: konsole_grantpty: fatal: libgcc_s.so.1: open failed: No such file or directory
kdevelop: chownpty failed for device /dev/ptyp1::/dev/ttyp1.
        : This means the session can be eavesdroped.
        : Make sure konsole_grantpty is installed and setuid root.
kdevelop (debugger): Debugger state: P:
kdevelop (debugger):
kdevelop (grep view): GrepViewPart::stopButtonClicked()
kdevelop (debugger): GDBController::slotStopDebugger() called
kdevelop (debugger): GDBController::slotStopDebugger() executing
kdevelop (debugger): App is busy
kdevelop (debugger): failed to write 'quit' to gdb
kdevelop (debugger): gdb not shutdown - killing
kdevelop (debugger): Debugger state:  :
kdevelop (debugger):    Debugger stopped
kdevelop (debugger): Disassemble widget active: false
kdevelop: Wiget has been undocked, setting tab down
--
Comment 8 Daniel Franke 2004-01-12 21:48:26 UTC
I'm sorry, I've set wrong path to gdb (v6.0). 
Here some more mesasges, debugging seems to work now (as it didn't before), nevertheless there still are the 'zombies':
-- ps -ef --
  franke  8901  8845  0                   0:00 <defunct>
  franke  8854  8845  0                   0:00 <defunct>
  franke  8897  8845  0                   0:00 <defunct>
  franke  8847  8845  0 22:32:45 pts/14   0:00 /usr/bin/bash
  franke  8905  8845  0                   0:00 <defunct>
  franke  8910  8845  0                   0:00 <defunct>
  franke  8845  8791  0 22:32:40 pts/12   3:02 kdevelop
  franke  8913  8845  0                   0:00 <defunct>
--

Debugging seems to work now :)
I'll have a more detailed look at this, soon.

-- konsole --
kdevelop (debugger): Debugger state: P:
kdevelop (debugger):
kdevelop (debugger): App is busy
kdevelop (debugger): Debugger state: A:
kdevelop (debugger):
kdevelop (debugger): Parsed (sh.lib) <Stopped due to shared library event>
kdevelop (debugger): App is paused (quietly)
kdevelop (debugger): App is busy
kdevelop (debugger): Debugger state: A:
kdevelop (debugger):
kdevelop (debugger): Parsed (sh.lib) <Stopped due to shared library event>
kdevelop (debugger): App is paused (quietly)
kdevelop (debugger): App is busy
kdevelop (debugger): Debugger state: A:
[...]

kdevelop (grep view): GrepViewPart::stopButtonClicked()
kdevelop (debugger): GDBController::slotStopDebugger() called
kdevelop (debugger): GDBController::slotStopDebugger() executing
kdevelop (debugger): App is busy
kdevelop (debugger): gdb not shutdown - killing
kdevelop (debugger): Debugger state:  :
kdevelop (debugger):    Debugger stopped
kdevelop (debugger): Disassemble widget active: false

Comment 9 Daniel Franke 2004-06-18 20:59:51 UTC
Still valid :(

GNU gdb 6.0
gcc version 3.4.0
Qt: 3.3.2
KDE: 3.2.3
KDevelop: 3.0.4
Comment 10 Jens Dagerbo 2005-01-15 09:46:15 UTC
Daniel, could you try changing the first arg at line 1269 (current HEAD) in kdevelop/languages/cpp/debugger/gdbcontroller.cpp from KProcess::NotifyOnExit to KProcess::OwnGroup and see if this makes any difference?

Like so:
dbgProcess_->start( KProcess::OwnGroup,
    KProcess::Communication(KProcess::All));
Comment 11 Daniel Franke 2005-01-16 02:14:02 UTC
Uhhh, I loathed to touch this one again ... but here we go =)

A first quick test whether anything has changed since the first report:
nope, the behaviour is quite the same in kdevelop-3.1.91 on KDE-3.4.91 (beta1) [I didn't compile HEAD but the source tarball released with KDE-3.4 (beta1)].

As to your suggestion Jens: nope, it doesn't help - same behaviour again.
Something to note:
-- stopping the debugger the first time --
kdevelop (debugger): App is busy
kdevelop (debugger): Debugger state: E:
kdevelop (debugger):    Process exited
kdevelop (debugger): Debugger state:  :
kdevelop (debugger):    Debugger stopped
--
-- the "same" lines as above, stopping the debugger the second time --
kdevelop (debugger): App is busy
kdevelop (debugger): gdb not shutdown - killing
kdevelop (debugger): Debugger state:  :
kdevelop (debugger):    Debugger stopped
--

There must be some interaction of a sort - somewhere. 
Here another session:
 - run app
   -> ok
 - run app
   -> ok
 - run app
   -> ok
 - start debugger
 - stop debugger
   ->no zombie so far
 - run app
   -> seems ok (the 'hello world' konsole is displayed and closed again)
 - run app
   -> kdevelop tells me that my app is currently running, just another zombie
   -> "Restart App" doesn't work, app is not restarted, doesn't start any more but no zombies are created - but I may debug it (and get more zombies)
   -> attempts to start the app are denied by kdev, it believes that the app is already running?!
Comment 12 Vladimir Prus 2005-08-19 11:05:07 UTC
I can't reproduce this with KDevelop 3.2.0 on Linux. Can you try with that version? Or the problem only happens on SunOS?
Comment 13 Jens Dagerbo 2006-04-15 20:52:32 UTC
*** Bug 125647 has been marked as a duplicate of this bug. ***
Comment 14 fongpwf 2006-05-02 03:11:12 UTC
I also see this with Kdevelop 3.3.1 with KDE 3.5.1-0.1.fc4.
Comment 15 Andreas Pakulat 2007-01-14 01:56:34 UTC
These zombie process occur when an application uses KProcess and QProcess to launch external processes at the same time. For KDevelop3.4 all cases we can control are fixed.