Details Ticket 1038


Comment | Reply | Take | Open


Serial Number 1038
Subject Tempfile cleanup problem revisited: G_tempfile()
Area bug
Queue grass
Requestors neteler@itc.it
Owner none
Status resolved
Last User Contact Sat Feb 26 17:40:18 2005 (3 yr ago)
Current Priority 30
Final Priority 70
Due No date assigned
Last Action Wed Sep 27 01:18:37 2006 (2 yr ago)
Created Sun May 5 20:23:00 2002 (6 yr ago)

Transaction History Ticket 1038


Sun, May 5 2002 20:23:00    Request created by guest  
Subject: Tempfile cleanup problem revisited: G_tempfile()

grass obtained from: CVS
grass binary for platform: Compiled from Sources
GRASS Version: latest CVS

Hi,

some of you may remember the thread about the GRASS tempfile problem:
http://grass.itc.it/pipermail/grass5/2002-April/002598.html

I have revisited the problem and done a draft check where G_tempfile() function
is used but the temp file not deleted later (using unlink()). This leads to left-over
files if GRASS is not left with "exit" (but simply the GRASS shell-window clicked
away) since $ETC/clean_temp won't be run in this case. In our networked GRASS
database I found 1GB leftover files.

My quick-and-dirty test has delivered:

find . -type f -name '*.c' -exec grep -l G_tempfile {} \;
find . -type f -name '*.c' -exec grep -l unlink {} \;

Diff'ed list of potential modules which call G_tempfile() but do not 
use the unlink() function to delete the tempfile(s) later:

 - example: r.drain

./src/mapdev/v.extract/inter/main.c
./src/mapdev/v.digit/digmain.c
./src/mapdev/v.digit/main.c
./src/mapdev/v.in.arc/main_cmd.c
./src/mapdev/v.in.arc/main_inter.c
./src/mapdev/v.in.mif/write_lines.c
./src/mapdev/v.in.shape/test/arctest1.c
./src/mapdev/v.out.arc/main.c
./src/mapdev/v.out.shape/main.c
./src/imagery/i.class/main.c
./src/imagery/i.pca/cmd/main.c
./src/imagery/i.points3/inter/list_group.c
./src/display/d.barscale/cmd/mouse.c
./src/display/d.display/histo.c
./src/display/d.label/cmd/label.c
./src/display/d.labels/do_label.c
./src/display/d.labels/proc_old.c
./src/display/d.profile/Range.c
./src/display/d.rast.edit/mk_tmp_file.c
./src/display/d.rast.edit/main.c
./src/display/d.rast.edit/mk_new_layer.c
./src/display/d.scale/cmd/draw_scale.c
./src/display/d.site.labels/do_labels.c
./src/display/d.text/cmd/main.c
./src/display/d.vect.labels/do_labels.c
./src/display/devices/CELL/Graph_Set.c
./src/display/devices/CELL/Graph_Clse.c
./src/display/devices/CELL/Panel.c
./src/display/devices/PNGdriver/Panel.c
./src/display/devices/XDRIVER/XDRIVER24/Panel.c
./src/display/devices/lib/connect_sock.c
./src/display/d.vect.area/d.vect.area.c
./src/display/d.vect.line/d.vect.line.c
./src/libes/display/popup.c
./src/general/init/clean_temp.c
./src/libes/g3d/g3dopen.c
./src/libes/g3d/g3dclose.c
./src/libes/g3d/g3drange.c
./src/libes/gis/closecell.c
./src/libes/gis/opencell.c
./src/libes/gis/put_title.c
./src/libes/gis/remove.c
./src/libes/lock/lock.c
./src/libes/lock/unlock.c
./src/libes/raster/Panel.c
./src/libes/raster/io.c
./src/libes/raster/new_io.c
./src/libes/vect32/Vlib/open1.c
./src/libes/vect32/bin_digit/bin_digit.c
./src/libes/vect32_64/Vlib/open1.c
./src/misc/m.dem.extract/getgrid.c
./src/misc/m.dem.extract/main.c
./src/misc/m.dem.extract/usgs_buf.c
./src/misc/m.dem.extract/usgs_num.c
./src/misc/m.svfit/hgnio.c
./src/misc/m.svfit/pltline.c
./src/paint/Programs/p.icons/edit.c
./src/misc/m.svfit/save.c
./src/paint/Drivers/shinko635/finish.c
./src/paint/Drivers/versatec/driver/finish.c
./src/paint/Drivers/versatec/driver/write.c
./src/paint/Interface/driverlib/interface.c
./src/paint/Programs/p.map/cmd/comment.c
./src/paint/Programs/p.map/cmd/label.c
./src/paint/Programs/p.map/cmd/main.c
./src/paint/Programs/p.map/cmd/plfile.c
./src/paint/Programs/p.map/cmd/session.c
./src/paint/Programs/p.map.new/cmd/barscale.c
./src/paint/Programs/p.map.new/cmd/colrtable.c
./src/paint/Programs/p.map.new/cmd/comment.c
./src/paint/Programs/p.map.new/cmd/do_barscale.c
./src/paint/Programs/p.map.new/cmd/do_legend.c
./src/paint/Programs/p.map.new/cmd/do_legendfin.c
./src/paint/Programs/p.map.new/cmd/label.c
./src/paint/Programs/p.map.new/cmd/legendtable.c
./src/paint/Programs/p.map.new/cmd/linefile.c
./src/paint/Programs/p.map.new/cmd/do_labels.c
./src/paint/Programs/p.map.new/cmd/main.c
./src/paint/Programs/p.map.new/cmd/plfile.c
./src/paint/Programs/p.map.new/cmd/pre_legend.c
./src/paint/Programs/p.map.new/cmd/regionfile.c
./src/paint/Programs/p.map.new/cmd/session.c
./src/ps.map/ps.map/cmd/comment.c
./src/ps.map/ps.map/cmd/label.c
./src/ps.map/ps.map/cmd/do_masking.c
./src/ps.map/ps.map/cmd/plfile.c
./src/ps.map/ps.map/cmd/session.c
./src/raster/r.agnps50/src_agnps_input_1/cell_num_id.c
./src/raster/r.agnps50/src_agnps_input_1/misc_routines.c
./src/raster/r.agnps50/src_agnps_input_2a/cell_num_id.c
./src/raster/r.agnps50/src_agnps_input_2a/misc_routines.c
./src/raster/r.binfer/reclass.c
./src/raster/r.drain/main.c
./src/raster/r.fill.dir/main.c
./src/raster/r.flow/io.13.c
./src/raster/r.mapcalc/mapcalc/main.c
./src/raster/r.out.mpeg/main.c
./src/raster/r.null/null.c
./src/raster/r.out.gridatb/check_ready.c
./src/raster/r.report/cmd/parse.c
./src/raster/r.support/inter/support.c
./src/raster/r.surf.contour/cmd/bseg_close.c
./src/raster/r.surf.contour/cmd/cseg_close.c
./src/raster/r.thin/cmd/thin_lines.c
./src/raster/r.topmodel/check_ready.c
./src/raster/r.watershed/seg/bseg_close.c
./src/raster/r.watershed/seg/cseg_close.c
./src/raster/r.watershed/seg/dseg_close.c
./src/raster/r.watershed/seg/seg_close.c
./src/raster/r.watershed/seg/sseg_close.c
./src/sites/s.sv/plthgpt.c
./src/sites/s.sv/save.c
./src/sites/s.probplt/save.c
./src/sites/s.to.rast/main.c
./src/sites/s.to.vect/cmd/main.c
./src/sites/s.to.rast/write_cell.c
./unused/display/d.vect.zoom/label.c
./unused/display/d.vect.zoom/what.c
./src.contrib/CERL/raster/r.water.fea/src/inter/shell.c
./unused/sites/s.menu/site_reports/run_report.c
./src.contrib/GMSL/g3d/src3d/raster/r3.mapcalc/mapcalc/main.c
./src.contrib/GMSL/xganim/main.c
./src.contrib/SCS/imp_exp/dig_dlg/v.exp_dlg.c
./src.contrib/SCS/imp_exp/dig_dlg/v.export_dlg.c
./src.contrib/SCS/imp_exp/dlg_dig/dlgcat.c
./src.contrib/SCS/imp_exp/gef_dig/imp_main.c
./src.contrib/SCS/imp_exp/tig_dig/imp_main.c
./src.contrib/SCS/mapdev/dlg_to_bdlg.scs/a_b_dlg.c
./src.contrib/SCS/misc/dotmaps/v.scale.random/main.c
./src.contrib/SCS/paint/Drivers/color.ps/text.c
./src.contrib/SCS/paint/Drivers/grey.ps/text.c
./src.contrib/SCS/paint/Drivers/grey.ps.n/text.c
./src.contrib/SCS/paint/Programs/color.map/cmd/comment.c
./src.contrib/SCS/paint/Programs/color.map/cmd/label.c
./src.contrib/GMSL/g3d/src3d/sites/s.vol.rst/user4.c
./src.contrib/SCS/paint/Drivers/driverlib/interface.c
./src.contrib/SCS/paint/Interface/driverlib/interface.c
./src.contrib/SCS/paint/Programs/color.map/cmd/main.c
./src.contrib/SCS/paint/Programs/color.map/cmd/plfile.c
./src.contrib/SCS/paint/Programs/color.map/cmd/session.c
./src.contrib/SCS/paint/Programs/grey.map/cmd/comment.c
./src.contrib/SCS/paint/Programs/grey.map/cmd/label.c
./src.contrib/SCS/paint/Programs/grey.map/cmd/main.c
./src.contrib/SCS/paint/Programs/grey.map/cmd/plfile.c
./src.contrib/SCS/paint/Programs/grey.map/cmd/session.c
./src.contrib/SCS/paint/Programs/newp.map/cmd/barscale.c
./src.contrib/SCS/paint/Programs/newp.map/cmd/colrtable.c
./src.contrib/SCS/paint/Programs/newp.map/cmd/comment.c
./src.contrib/SCS/paint/Programs/newp.map/cmd/do_barscale.c
./src.contrib/SCS/paint/Programs/newp.map/cmd/do_legend.c
./src.contrib/SCS/paint/Programs/newp.map/cmd/label.c
./src.contrib/SCS/paint/Programs/newp.map/cmd/legendtable.c
./src.contrib/SCS/paint/Programs/newp.map/cmd/linefile.c
./src.contrib/SCS/paint/Programs/newp.map/cmd/main.c
./src.contrib/SCS/paint/Programs/newp.map/cmd/plfile.c
./src.contrib/SCS/paint/Programs/newp.map/cmd/pre_legend.c
./src.contrib/SCS/paint/Programs/newp.map/cmd/regionfile.c
./src.contrib/SCS/paint/Programs/newp.map/cmd/session.c
./src.contrib/SCS/paint/Programs/ps.map/session.c
./src.contrib/SCS/paint/Programs/ps.map/main.c
./src.contrib/SCS/raster/r.in.miads/cmd/proces.c
./src.contrib/SCS/raster/r.reclass.scs/inter/main.c
./src.contrib/SCS/sites/s.dotmap.new/inter/main.c
./src.contrib/SCS/sites/s.dotmap.new/inter/sfactor.c
./src.contrib/SCS/vector/v.dump/cmd/edit_head.c
./src.contrib/SCS/vector/v.mk_stats/do_stats.c
./src.contrib/SCS/vector/v.proj/cmd/main.c
./src.contrib/SDTS/mapdev/v.in.sdts/wr_attrs.c
./src.garden/answers/src.answers/raster/r.direct/cmd/direct.c

(slightly cleaned up list)

These modules have to be checked if the G_tempfile is properly
deleted on G_fatal_error() or successful module termination.

Markus
Sun, May 5 2002 22:45:39    Mail sent by neteler@itc.it  
Return-Path <neteler@itc.it>
Delivered-To grass-bugs@lists.intevation.de
Date Sun, 5 May 2002 22:45:35 +0200
From Markus Neteler <neteler@itc.it>
To Request Tracker <grass-bugs@intevation.de>
Cc grass5@grass.itc.it
Subject Re: [GRASS5] [bug #1038] (grass) Tempfile cleanup problem revisited: G_tempfile()
Message-ID <20020505224535.A14654@itc.it>
Mail-Followup-To Request Tracker <grass-bugs@intevation.de>, grass5@grass.itc.it
References <20020505182301.693E613A1F@lists.intevation.de>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.2.5.1i
In-Reply-To <20020505182301.693E613A1F@lists.intevation.de>; from grass-bugs@intevation.de on Sun, May 05, 2002 at 08:23:01PM +0200
X-Spam-Status No, hits=0 required=5 tests=
A followup:

the same problem of left-over temp-files occurs when a
running GRASS module (which uses G_tempfile()) is terminated
with CTRL-C or the kill command.
Perhaps we could add some code to the signal handler (if present in
GRASS) to delete open temp files when SIGINT, SIGQUIT, SIGKILL, SIGTERM
occur. The temp file name is the PID of the running process.

Markus


On Sun, May 05, 2002 at 08:23:01PM +0200, Request Tracker wrote:
> this bug's URL: http://intevation.de/rt/webrt?serial_num=1038
> -------------------------------------------------------------------------
> 
> Subject: Tempfile cleanup problem revisited: G_tempfile()
[...]


Mon, May 6 2002 02:00:40    Mail sent by glynn.clements@virgin.net  
Return-Path <glynn.clements@virgin.net>
Delivered-To grass-bugs@lists.intevation.de
From Glynn Clements <glynn.clements@virgin.net>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Message-ID <15573.51004.366779.104825@cerise.nosuchdomain.co.uk>
Date Mon, 6 May 2002 00:58:52 +0100
To Markus Neteler <neteler@itc.it>
Cc Request Tracker <grass-bugs@intevation.de>, grass5@grass.itc.it
Subject Re: [GRASS5] [bug #1038] (grass) Tempfile cleanup problem revisited: G_tempfile()
In-Reply-To <20020505224535.A14654@itc.it>
References <20020505182301.693E613A1F@lists.intevation.de> <20020505224535.A14654@itc.it>
X-Mailer VM 6.94 under 21.4 (patch 4) "Artificial Intelligence (candidate #1)" XEmacs Lucid
X-Spam-Status No, hits=0 required=5 tests=
Markus Neteler wrote:

> the same problem of left-over temp-files occurs when a
> running GRASS module (which uses G_tempfile()) is terminated
> with CTRL-C or the kill command.
> Perhaps we could add some code to the signal handler (if present in
> GRASS) to delete open temp files when SIGINT, SIGQUIT, SIGKILL, SIGTERM
> occur.

You *cannot* catch SIGKILL. Also, you can't realistically handle
SIGSEGV either; although you can catch it, the memory might be too
badly corrupted to actually do anything about it.

-- 
Glynn Clements <glynn.clements@virgin.net>


Mon, May 6 2002 13:35:36    Mail sent by mneteler  
Here an updated list of unlink-missing candidates:

src/display/d.barscale/cmd/mouse.c
src/display/d.display/histo.c # uses fclose() should be unlink?

src/display/d.label/cmd/label.c 
src/display/d.labels/do_label.c
src/display/d.labels/proc_old.c

src/display/d.profile/Range.c 

src/display/d.rast.edit/mk_tmp_file.c #uses creat() ? no close

src/display/d.scale/cmd/draw_scale.c

src/display/d.site.labels/do_labels.c # is R_panel_delete sufficient?

src/display/d.text/cmd/main.c
src/display/d.vect.area/d.vect.area.c
src/display/d.vect.labels/do_labels.c
src/display/d.vect.line/d.vect.line
src/display/devices/CELL/Graph_Set.c
src/imagery/i.class/main.c  (obviously tempfile is opened but not used)

src/libes/display/popup.c
src/libes/g3d/g3dopen.c
src/libes/gis/opencell.c
src/libes/gis/put_title.c

src/mapdev/v.extract/inter/main.c
src/mapdev/v.in.arc/main_cmd.c
src/mapdev/v.in.arc/main_inter.c
src/misc/m.svfit/hgnio.c
src/misc/m.svfit/pltline.c
src/paint/Programs/p.icons/edit.c
src/paint/Programs/p.map/cmd/comment.c
src/paint/Programs/p.map/cmd/label.c
src/paint/Programs/p.map/cmd/plfile.c
src/paint/Programs/p.map/cmd/session.c
src/paint/Programs/p.map.new/cmd/barscale.c
src/paint/Programs/p.map.new/cmd/colrtable.c
src/paint/Programs/p.map.new/cmd/comment.c
src/paint/Programs/p.map.new/cmd/do_barscale.c
src/paint/Programs/p.map.new/cmd/do_legend.c
src/paint/Programs/p.map.new/cmd/do_legendfin.c
src/paint/Programs/p.map.new/cmd/label.c
src/paint/Programs/p.map.new/cmd/legendtable.c
src/paint/Programs/p.map.new/cmd/linefile.c
src/paint/Programs/p.map.new/cmd/plfile.c
src/paint/Programs/p.map.new/cmd/pre_legend.c
src/paint/Programs/p.map.new/cmd/regionfile.c
src/paint/Programs/p.map.new/cmd/session.c
src/ps.map/ps.map/cmd/comment.c
src/ps.map/ps.map/cmd/label.c
src/ps.map/ps.map/cmd/plfile.c
src/ps.map/ps.map/cmd/session.c
src/raster/r.agnps50/src_agnps_input_1/cell_num_id.c
src/raster/r.agnps50/src_agnps_input_1/misc_routines.c
src/raster/r.agnps50/src_agnps_input_2a/cell_num_id.c
src/raster/r.agnps50/src_agnps_input_2a/misc_routines.c
src/raster/r.fill.dir/main.c
src/raster/r.flow/io.13.c
src/raster/r.mapcalc/mapcalc/main.c
src/raster/r.out.mpeg/main.c
src/sites/s.sv/plthgpt.c
src/sites/s.to.rast/main.c
src/sites/s.to.vect/cmd/main.c
src.contrib/CERL/raster/r.water.fea/src/inter/shell.c
src.contrib/GMSL/g3d/src3d/raster/r3.mapcalc/mapcalc/main.c
src.contrib/GMSL/xganim/main.c
src.contrib/SCS/imp_exp/dig_dlg/v.exp_dlg.c
src.contrib/SCS/imp_exp/dig_dlg/v.export_dlg.c
src.contrib/SCS/imp_exp/dlg_dig/dlgcat.c
src.contrib/SCS/imp_exp/gef_dig/imp_main.c
src.contrib/SCS/imp_exp/tig_dig/imp_main.c
src.contrib/SCS/mapdev/dlg_to_bdlg.scs/a_b_dlg.c
src.contrib/SCS/misc/dotmaps/v.scale.random/main.c
src.contrib/SCS/paint/Drivers/color.ps/text.c
src.contrib/SCS/paint/Drivers/grey.ps/text.c
src.contrib/SCS/paint/Drivers/grey.ps.n/text.c
src.contrib/SCS/paint/Programs/color.map/cmd/comment.c
src.contrib/SCS/paint/Programs/color.map/cmd/label.c
src.contrib/SCS/paint/Programs/color.map/cmd/plfile.c
src.contrib/SCS/paint/Programs/color.map/cmd/session.c
src.contrib/SCS/paint/Programs/grey.map/cmd/comment.c
src.contrib/SCS/paint/Programs/grey.map/cmd/label.c
src.contrib/SCS/paint/Programs/grey.map/cmd/plfile.c
src.contrib/SCS/paint/Programs/grey.map/cmd/session.c
src.contrib/SCS/paint/Programs/newp.map/cmd/barscale.c
src.contrib/SCS/paint/Programs/newp.map/cmd/colrtable.c
src.contrib/SCS/paint/Programs/newp.map/cmd/comment.c
src.contrib/SCS/paint/Programs/newp.map/cmd/do_barscale.c
src.contrib/SCS/paint/Programs/newp.map/cmd/do_legend.c
src.contrib/SCS/paint/Programs/newp.map/cmd/label.c
src.contrib/SCS/paint/Programs/newp.map/cmd/legendtable.c
src.contrib/SCS/paint/Programs/newp.map/cmd/linefile.c
src.contrib/SCS/paint/Programs/newp.map/cmd/plfile.c
src.contrib/SCS/paint/Programs/newp.map/cmd/pre_legend.c
src.contrib/SCS/paint/Programs/newp.map/cmd/regionfile.c
src.contrib/SCS/paint/Programs/newp.map/cmd/session.c
src.contrib/SCS/paint/Programs/ps.map/session.c
src.contrib/SCS/raster/r.in.miads/cmd/proces.c
src.contrib/SCS/raster/r.reclass.scs/inter/main.c
src.contrib/SCS/sites/s.dotmap.new/inter/main.c
src.contrib/SCS/sites/s.dotmap.new/inter/sfactor.c
src.contrib/SCS/vector/v.mk_stats/do_stats.c
src.contrib/SCS/vector/v.proj/cmd/main.c
src.garden/answers/src.answers/raster/r.direct/cmd/direct.c

At least the data intensive modules should be fixed.

 Markus
Wed, Jun 5 2002 16:12:39    Priority changed to 30 by mneteler  
Sat, Feb 26 2005 17:40:18    Mail sent by mneteler  
Seems to be resolved in 6.0.0beta2.

MN
Sat, Feb 26 2005 17:40:21    Status changed to resolved by mneteler  
Tue, Sep 26 2006 18:28:40    Comments added by guest  
Good Luck! http://xoomer.alice.it/pik0/poker-rooms/
Tue, Sep 26 2006 22:27:32    Comments added by guest  
Cool design http://xoomer.alice.it/pik0/razz-poker/
Wed, Sep 27 2006 01:18:37    Comments added by guest  
Great work on website. <a href="http://xoomer.alice.it/pik0/rules-of-poker/">rules
of poker</a> [url=http://xoomer.alice.it/pik0/rules-of-poker/]rules of poker[/url]
http://xoomer.alice.it/pik0/rules-of-poker/
Comment | Reply | Take | Open

You are currently authenticated as guest.
[Show Configuration] [Login as another user]

Users Guide - Mail Commands - Homepage of RequestTracker 1.0.7 - list any request