Opened 14 years ago

Closed 13 years ago

#1110 closed defect (fixed)

v.rast.stats locks up on wingrass

Reported by: hamish Owned by: grass-dev@…
Priority: critical Milestone: 6.4.2
Component: Vector Version: svn-releasebranch64
Keywords: wingrass, v.rast.stats, v.db.addcol, v.info Cc:
CPU: x86-32 Platform: MSWindows XP

Description

Hi, as reported on the ML:

http://thread.gmane.org/gmane.comp.gis.grass.user/36116/

the shell script version of v.rast.stats gets stuck on WinGrass.

for me using XP from the msys rxvt command prompt it works about 50% of the time. Sometimes there was a left over v.info.exe in the ctrl-alt-del process list, sometimes a db.describe. Adding -x to the shebang only helps as far as g.parser. I've now added some new debug messages in 6.5svn, maybe they help determine if it is before or in v.db.addcol ? C does not seem to work in the msys rxvt bash session so to kill it I had to either kill grass or kill the hung process in the ctrl-alt-del process list at which point the script bailed out.

Hamish

Change History (17)

comment:1 by hamish, 14 years ago

Yvan wrote:

This is the function and the message :

(Mon Jul 19 15:12:58 2010)
v.rast.stats vector=parcelles_masquees@mercier raster=mntyzeron_5m@mercier colprefix=mnt
C:/GRASS-64-SVN/scripts/v.rast.stats: line 268: v.db.addcol:
command not found
ERROR: Cannot continue (problem adding columns).
(Mon Jul 19 15:13:06 2010) Command finished (7 sec)

although I've only seen the subprocess freezing manifestation of this.

comment:2 by hellik, 13 years ago

Milestone: 6.4.06.4.2

comment:3 by hellik, 13 years ago

Priority: normalcritical

in reply to:  1 ; comment:4 by hellik, 13 years ago

tested with WinGRASS-6.4.SVN-r47756-1-Setup.exe

there seems to be 2 issues here:

(1) v.rast.stats seems not to be able to invoke v.db.addcol which is in C:\Program Files\GRASS 6.4.SVN\scripts and has a wrapper script in C:\Program Files\GRASS 6.4.SVN\bin\v.db.addcol.bat

Replying to hamish:

Yvan wrote: C:/GRASS-64-SVN/scripts/v.rast.stats: line 268: v.db.addcol: command not found ERROR: Cannot continue (problem adding columns).

(2) v.db.addcol seems not to be able to add a column in windows with the dbf-driver, but it's able with the sqlite-driver

Helmut

comment:5 by hamish, 13 years ago

a long standing question is why on the same machine it works sometimes but not others; and why plenty of other scripts can call each other, seemingly without any trouble..?

some quick examples,

  • v.in.lines calls the v.in.mapgen script;
  • v.db.renamecol and v.db.join calls the v.db.addcol script.
  • the script version of v.colors calls v.db.addcol too.
  • r.in.wms & i.oif are a bit different, as they call their own support scripts outside of the normal path. r.in.wms is a tangle, but i.oif should be easy enough to work through by hand.

any trouble with those?

are you working from the rxvt/msys prompt? the cmd.exe DOS prompt? from within the GUI? does that make a difference?

thanks, Hamish

in reply to:  5 ; comment:6 by hellik, 13 years ago

Replying to hamish:

are you working from the rxvt/msys prompt? the cmd.exe DOS prompt? from within the GUI? does that make a difference?

tested with wingrass-nightly-build WinGRASS-6.4.SVN-r47775-1-Setup.exe sqlite as db-backend

(1) "GRASS 6.4.SVN with MSYS" => v.rast.stats-wxgui

v.rast.stats --verbose vector=mylakes@g7 raster=elevation@PERMANENT colprefix=gui
Adding columns ' gui_n INTEGER, gui_min DOUBLE PRECISION, gui_max DOUBLE PRECISION, gui_range DOUBLE PRECISION, gui_mean DOUBLE PRECISION, gui_stddev DOUBLE PRECISION, gui_variance DOUBLE PRECISION, gui_cf_var DOUBLE PRECISION, gui_sum DOUBLE PRECISION'
Processing data (766 categories)...
Processing category 6229 (1/766)
[...]
Processing category 11145 (766/766)
Updating the database ...
Statistics calculated from raster map <elevation@PERMANENT> and uploaded to     attribute table of vector map <mylakes>.
Done.

(Sun Aug 21 19:31:02 2011) Command finished (1647 sec)

(2) "GRASS 6.4.SVN with MSYS" in the wxgui-command-console

v.rast.stats --verbose vector=mylakes@g7 raster=elevation@PERMANENT colprefix=cons
Adding columns ' cons_n INTEGER, cons_min DOUBLE PRECISION, cons_max DOUBLE PRECISION, cons_range DOUBLE PRECISION, cons_mean DOUBLE PRECISION, cons_stddev DOUBLE PRECISION, cons_variance DOUBLE PRECISION, cons_cf_var DOUBLE PRECISION, cons_sum DOUBLE PRECISION'
Processing data (766 categories)...
Processing category 6229 (1/766)
[...]
Processing category 11145 (766/766)
Updating the database ...
Statistics calculated from raster map <elevation@PERMANENT> and uploaded to     attribute table of vector map <mylakes>.
Done.

(3) "GRASS 6.4.SVN with MSYS" in the wingrass-msys-shell

GRASS 6.4> v.rast.stats --verbose vector=mylakes@g7 raster=elevation@PERMANENT
 colprefix=msys
Adding columns ' msys_n INTEGER, msys_min DOUBLE PRECISION, msys_max DOUBLE
PRECISION, msys_range DOUBLE PRECISION, msys_mean DOUBLE PRECISION,
msys_stddev DOUBLE PRECISION, msys_variance DOUBLE PRECISION, msys_cf_var
DOUBLE PRECISION, msys_sum DOUBLE PRECISION'
Processing data (766 categories)...
Processing category 6229 (1/766)
[...]
Processing category 11145 (766/766)
Updating the database ...
Statistics calculated from raster map <elevation@PERMANENT> and uploaded to
attribute table of vector map <mylakes>.
Done.

(4) "GRASS Command Line" - wingrass in text-mode (windows-command-line)

GRASS 6.4.2svn (nc_spm_08)> v.rast.stats --verbose vector=mylakes@g7 raster=elev
ation@PERMANENT colprefix=msdos
Adding columns ' msdos_n INTEGER, msdos_min DOUBLE PRECISION, msdos_max
DOUBLE PRECISION, msdos_range DOUBLE PRECISION, msdos_mean DOUBLE
PRECISION, msdos_stddev DOUBLE PRECISION, msdos_variance DOUBLE PRECISION,
msdos_cf_var DOUBLE PRECISION, msdos_sum DOUBLE PRECISION'
C:/Program Files/GRASS 6.4.SVN/scripts/v.rast.stats: line 285: v.db.addcol: command not found
FEHLER: Cannot continue (problem adding columns).

(5) GRASS 6.4.SVN (desktop shortcut without msys)

v.rast.stats --verbose vector=mylakes@g7 raster=elevation@PERMANENT colprefix=owxgui
Adding columns ' owxgui_n INTEGER, owxgui_min DOUBLE PRECISION, owxgui_max DOUBLE PRECISION, owxgui_range DOUBLE PRECISION, owxgui_mean DOUBLE PRECISION, owxgui_stddev DOUBLE PRECISION, owxgui_variance DOUBLE PRECISION, owxgui_cf_var DOUBLE PRECISION, owxgui_sum DOUBLE PRECISION'
C:/Program Files/GRASS 6.4.SVN/scripts/v.rast.stats: line
285: v.db.addcol: command not found
ERROR: Cannot continue (problem adding columns).

in case (1), (2), (3) wingrass is started by "C:\Program Files\GRASS 6.4.SVN\msys\msys.bat" /grass/bin/grass64svn -wxpython

in case (4) wingrass is started by "C:\Program Files\GRASS 6.4.SVN\grass64svn.bat" -text

in case (5) wingrass is started by "C:\Program Files\GRASS 6.4.SVN\grass64svn.bat" -wxpython

so it seems that the v.db.addcol-script can't be find by the v.rast.stat-script when wingrass is started via grass64svn.bat, but it's possible in wingrass started via msys-way.

best regards Helmut

in reply to:  6 ; comment:7 by hamish, 13 years ago

Replying to hellik:

so it seems that the v.db.addcol-script can't be find by the v.rast.stat-script when wingrass is started via grass64svn.bat, but it's possible in wingrass started via msys-way.

.. interesting.

does v.in.lines work in the grass64svn.bat cases?

C:\> copy con test.dat
167.846717,-46.516653
167.846663,-46.516645
167.846656,-46.516644
167.846649,-46.516644
167.846642,-46.516643
NaN,NaN
167.846520,-46.516457
167.846528,-46.516461
167.846537,-46.516464
167.846535,-46.516486
167.846544,-46.516489
167.846552,-46.516493
^Z

v.in.lines in=test.dat out=two_lines fs=,

thanks, Hamish

in reply to:  7 comment:8 by hellik, 13 years ago

Replying to hamish:

.. interesting.

does v.in.lines work in the grass64svn.bat cases?

C:\> copy con test.dat
167.846717,-46.516653
167.846663,-46.516645
167.846656,-46.516644
167.846649,-46.516644
167.846642,-46.516643
NaN,NaN
167.846520,-46.516457
167.846528,-46.516461
167.846537,-46.516464
167.846535,-46.516486
167.846544,-46.516489
167.846552,-46.516493
^Z

v.in.lines in=test.dat out=two_lines fs=,

would this a example for spearfish- or nc-sample data set?

best regards Helmut

in reply to:  7 ; comment:9 by hellik, 13 years ago

Replying to hamish:

does v.in.lines work in the grass64svn.bat cases?

simple testcase for nc-sample-dataset

633249.504950,224984.653465
639210.891089,227256.930693
643728.712871,216510.396040
NaN,NaN
630763.366337,216243.069307
637954.455446,215681.683168
643996.039604,215521.287129

(1) "GRASS 6.4.SVN with MSYS" (started by "C:\Program Files\GRASS 6.4.SVN\msys\msys.bat" /grass/bin/grass64svn -wxpython)

v.in.lines --verbose input=J:\test.dat output=twolines2 fs=,                    
Importing with v.in.ascii ...
Erstelle Topologie für die Vektorkarte <twolines2>...
Registriere Primitive...
2 Primitive registriert
6 Vertices registriert
Erzeuge Flächen...
0 Flächen angelegt
0 Inseln angelegt
Füge Inseln hinzu...
Füge Zentroide hinzu...
Die Topologie wurde erstellt
Anzahl der Knoten: 4
Anzahl der Primitive: 2
Anzahl der Punkte: 0
Anzahl der Linien: 2
Anzahl der Grenzen: 0
Anzahl der Zentroide: 0
Anzahl der Flächen: 0
Anzahl der Inseln: 0
v.in.ascii komplett.
"twolines2@g7" successfully created.
(Mon Aug 22 01:32:33 2011) Command finished (2 sec)

(2) "GRASS 6.4.SVN" (started by "C:\Program Files\GRASS 6.4.SVN\grass64svn.bat" -wxpython)

v.in.lines --verbose input=J:\test.dat output=twolines2 fs=,                    
C:/Program Files/GRASS 6.4.SVN/scripts/v.in.lines: line 126:
v.in.mapgen: command not found

so v.in.lines seems not to work in the grass64svn.bat-case.

best regards Helmut

in reply to:  5 ; comment:10 by hellik, 13 years ago

Replying to hamish:

a long standing question is why on the same machine it works sometimes but not others; and why plenty of other scripts can call each other, seemingly without any trouble..?

adding \bin and \scripts to the %PATH% to C:\Program Files\GRASS 6.4.SVN\etc\env.bat helps v.rast.stat to invoke v.db.addcol in the grass64svn.bat-case

rem Set Path to utilities (libraries and bynaries) used by GRASS
set PATH=%GISBASE%\msys\bin;%PATH%
set PATH=%GISBASE%\extrabin;%GISBASE%\extralib;%PATH%
set PATH=%GISBASE%\tcl-tk\bin;%GISBASE%\sqlite\bin;%GISBASE%\gpsbabel;%PATH%
set PATH=%GISBASE%\bin;%GISBASE%\scripts;%PATH%

Helmut

in reply to:  10 comment:11 by hellik, 13 years ago

Replying to hellik:

adding \bin and \scripts to the %PATH% to C:\Program Files\GRASS 6.4.SVN\etc\env.bat helps v.rast.stat to invoke v.db.addcol in the grass64svn.bat-case

v.rast.stats vector=mylakes@g7 raster=elevation@PERMANENT colprefix=pahk        
Processing data (766 categories)...
Updating the database ...
Statistics calculated from raster map <elevation@PERMANENT> and uploaded to     attribute table of vector map <mylakes>.
Done.
(Tue Aug 23 12:34:46 2011) Befehl ausgeführt (1657 sec)

so adding to the path seems to be solution...

Helmut

in reply to:  9 comment:12 by hellik, 13 years ago

Replying to hellik:

(2) "GRASS 6.4.SVN" (started by "C:\Program Files\GRASS 6.4.SVN\grass64svn.bat" -wxpython)

[...]

so v.in.lines seems not to work in the grass64svn.bat-case.

with the path-addition also v.in.lines works in the grass64svn.bat-case.

Helmut

comment:13 by hamish, 13 years ago

brilliant!

in reply to:  4 ; comment:14 by hellik, 13 years ago

Replying to hellik:

tested with WinGRASS-6.4.SVN-r47756-1-Setup.exe

there seems to be 2 issues here:

(1) v.rast.stats seems not to be able to invoke v.db.addcol which is in C:\Program Files\GRASS 6.4.SVN\scripts and has a wrapper script in C:\Program Files\GRASS 6.4.SVN\bin\v.db.addcol.bat

Replying to hamish:

Yvan wrote: C:/GRASS-64-SVN/scripts/v.rast.stats: line 268: v.db.addcol: command not found ERROR: Cannot continue (problem adding columns).

with the path-addition this issue seems to be solved

(2) v.db.addcol seems not to be able to add a column in windows with the dbf-driver, but it's able with the sqlite-driver

all tests above with sqlite as db-backend are working here in all different wingrass-starting cases.

switching to dbf as db-backend:

(1) v.rast.stats in the "C:\Program Files\GRASS 6.4.SVN\msys\msys.bat" /grass/bin/grass64svn -wxpython"-case seems to work here

but

(2) v.rast.stats in grass64svn.bat-case wingrass freezes

Helmut

in reply to:  14 comment:15 by hellik, 13 years ago

Replying to hellik:

(2) v.rast.stats in grass64svn.bat-case wingrass freezes

sorry for the noise, DEBUG=3 freezed wingrass.

with DEBUG=0, v.rast.stats with dbf as db-backend also work in grass64svn.bat-case (tested several times)

Helmut

in reply to:  13 comment:16 by hellik, 13 years ago

Replying to hamish:

brilliant!

committed

r47869 grass64svn r47870 grass65svn r47871 grass70svn

please test

Helmut

comment:17 by hamish, 13 years ago

Resolution: fixed
Status: newclosed

v.in.lines and v.rast.stats working from DOS prompt in 6.4svn nightly native wingrass build. closing bug.

Note: See TracTickets for help on using tickets.