[GRASS5] [bug #4049] (grass) d.m: dozens of d.mon zombies

Glynn Clements glynn at gclements.plus.com
Tue Jan 31 14:00:11 EST 2006

Request Tracker wrote:

> this bug's URL: http://intevation.de/rt/webrt?serial_num=4049
> -------------------------------------------------------------------------
> Subject: d.m: dozens of d.mon zombies
> Platform: GNU/Linux/x86
> grass obtained from: Trento Italy site
> grass binary for platform: Compiled from Sources
> GRASS Version: CVS 2005.01.27
> Uisng d.m leads to lots of zombi d.mon processes.
> 1. grass61 -text
> 2. d.m
> 3. ps -A | grep d.mon
> 19313 pts/2    00:00:00 d.mon <defunct>
> 4. press "x1" in d.m, or redraw, zoom, pan
> 5. ps -A | grep d.mon
> 19313 pts/2    00:00:00 d.mon <defunct>
> 19340 pts/2    00:00:00 d.mon <defunct>
> ... and so on.
> By the end of Grass session there are dozens of d.mon zombies. Quiting d.m colses them all.

FWIW, I also see lots of g.region zombies.

AFAICT, it's due to the use of "open", e.g.:

gm.tcl:298:		if ![catch {open "|d.mon -L" r} input] {
gm.tcl:319:		if ![catch {open "|d.mon -L" r} input] {
gm.tcl:385:		if ![catch {open "|d.mon -L" r} input] {
gm.tcl:611:		if ![catch {open "|d.mon -L" r} input] {
mapcanvas.tcl:233:	if ![catch {open "|g.region -g" r} input] {
mapcanvas.tcl:283:	if ![catch {open "|d.mon -L" r} input] {
mapcanvas.tcl:436:	if ![catch {open "|g.region -g" r} input] {
mapcanvas.tcl:599:	if ![catch {open "|g.region -g" r} input] {
mapcanvas.tcl:962:	if ![catch {open "|g.region -g" r} input] {
vector.tcl:548:		if ![catch {open "|d.mon -L" r} input] {

I can't find a single case which calls "close $input" once the stream
is finished with. I suspect that wish won't actually wait() for the
process until you call close, hence the accumulation of zombies.

BTW, I suspect that most of those "d.mon -L" commands are unnecessary. 
You should be unconditionally starting the monitor before drawing
anything and unconditionally stopping it once you're done.

Also, none of the "d.mon start=PNG" commands have the -s switch; this
will interfere with the user's choice of selected monitor. Use -s and
$MONITOR_OVERRIDE instead of modifying $GISRC.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list