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

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.

Maciek

-------------------------------------------- Managed by Request Tracker

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@gclements.plus.com>

Thanks. This will help I'm sure.

Michael
______________________________
Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
Arizona State University
Tempe, AZ 85287-2402
USA

voice: 480-965-6262; fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Glynn Clements <glynn@gclements.plus.com>
Date: Tue, 31 Jan 2006 19:00:11 +0000
To: Request Tracker <grass-bugs@intevation.de>
Cc: <grass5@grass.itc.it>, Michael Barton <michael.barton@asu.edu>
Subject: Re: [GRASS5] [bug #4049] (grass) d.m: dozens of d.mon zombies

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@gclements.plus.com>

Glynn,

I implemented these suggestions and it seems to help a lot. Most of the open
"|d.mon -L" calls were left over from the old d.m and I got rid of them.
However, a few did leave these open. I've fixed these. I'm also using the -s
flag and MONITOR_OVERRIDE.

These seem to have nearly eliminated the unable to fork child process
errors. It's probably still breakable, but considerably more difficult to do
so.

Thanks much.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution and Social Change
Arizona State University
Tempe, AZ 85287-2402

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Glynn Clements <glynn@gclements.plus.com>
Date: Tue, 31 Jan 2006 19:00:11 +0000
To: Request Tracker <grass-bugs@intevation.de>
Cc: <grass5@grass.itc.it>, Michael Barton <michael.barton@asu.edu>
Subject: Re: [GRASS5] [bug #4049] (grass) d.m: dozens of d.mon zombies

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@gclements.plus.com>