Details Ticket 4725


Comment | Reply | Take | Resolve


Serial Number 4725
Subject nviz crashed while volume visualisation
Area grass6
Queue grass
Requestors soerengebbert@gmx.de
Owner none
Status open
Last User Contact Tue Apr 24 11:46:57 2007 (1 yr ago)
Current Priority 30
Final Priority 70
Due No date assigned
Last Action Mon May 28 12:11:15 2007 (1 yr ago)
Created Fri Jun 23 19:31:10 2006 (2 yr ago)

Transaction History Ticket 4725


Fri, Jun 23 2006 19:31:10    Request created by guest  
Subject: nviz crashed while volume visualisation

Platform: GNU/Linux/x86
grass obtained from: CVS
grass binary for platform: Compiled from Sources
GRASS Version: latest grass-6.1-cvs

Hi,
nviz produced a segfault while volume data visualisation.
Im using the lates cvs build.

I have tested this with several locations. 
gdb output of nviz within spearfish60 location:


Mapset <user1> in Location <spearfish60>                                    
GRASS 6.1.cvs > gdb nviz
gdb) r volume=g3d_test_map_2_30960
Starting program: /usr/local/grass-6.1.cvs/bin/nviz volume=g3d_test_map_2_30960
[Thread debugging using libthread_db enabled]
[New Thread -1225509184 (LWP 15853)]
[New Thread -1225512016 (LWP 15856)]
%
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1225509184 (LWP 15853)]
0xb74b6b66 in __strtouq_internal () from /lib/tls/libc.so.6
(gdb) bt
#0  0xb74b6b66 in __strtouq_internal () from /lib/tls/libc.so.6
#1  0xb74b690f in __strtol_internal () from /lib/tls/libc.so.6
#2  0x080665e7 in Ndraw_all_together_cmd (data=0x8070f60, interp=0x0, argc=10,
argv=0xa) at /usr/include/stdlib.h:333
#3  0xb782db27 in TclInvokeStringCommand () from /usr/lib/libtcl8.4.so.0
#4  0xb782f32a in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#5  0xb7830b56 in Tcl_EvalEx () from /usr/lib/libtcl8.4.so.0
#6  0xb78310d6 in Tcl_Eval () from /usr/lib/libtcl8.4.so.0
#7  0x08063a7e in display_cb (togl=0xa) at togl_cb.c:73
#8  0x08060a15 in Togl_Render (clientData=0x81d4a00) at togl.c:1167
#9  0xb7890c09 in TclServiceIdle () from /usr/lib/libtcl8.4.so.0
#10 0xb787f230 in Tcl_DoOneEvent () from /usr/lib/libtcl8.4.so.0
#11 0xb7948d5d in Tk_FrameObjCmd () from /usr/lib/libtk8.4.so.0
#12 0xb7890c09 in TclServiceIdle () from /usr/lib/libtcl8.4.so.0
#13 0xb787f230 in Tcl_DoOneEvent () from /usr/lib/libtcl8.4.so.0
#14 0xb7922dad in Tk_MainLoop () from /usr/lib/libtk8.4.so.0
#15 0xb792f513 in Tk_MainEx () from /usr/lib/libtk8.4.so.0
#16 0x08060653 in main (argc=3, argv=0xbfebad94) at nvizMain.c:50


The g3d map info:
Mapset <user1> in Location <spearfish60>                                    
GRASS 6.1.cvs > r3.info g3d_test_map_2_30960
 +----------------------------------------------------------------------------+
| Layer:    g3d_test_map_2_30960           Date: Fri Apr 14 16:57:49 2006   
|
 | Mapset:   user1                          Login of Creator: soeren        
|
 | Location: spearfish60                                                    
|
 | DataBase: /home/soeren/grassdaten                                        
|
 | Title:     ( g3d_test_map_2_30960 )                                      
|
 | Timestamp: none                                                          
|
 |----------------------------------------------------------------------------|
|                                                                           
|
 |   Type of Map:  3d cell              Number of Categories: 0             
|
 |   Data Type:    double                                                   
|
 |   Rows:         1                                                        
|
 |   Columns:      1                                                        
|
 |   Depths:       80                                                       
|
 |   Total Cells:  80                                                       
|
 |        Projection: UTM (zone 13)                                         
|
 |            N:         13    S:          0   Res:    13                   
|
 |            E:         13    W:          0   Res:    13                   
|
 |            T:         80    B:          0   Res:     1                   
|
 |   Range of data:   min = 1.13171925 max = 1.13171925                     
|
 |                                                                          
|
 |   Data Source:                                                           
|
 |                                                                          
|
 |                                                                          
|
 |                                                                          
|
 |   Data Description:                                                      
|
 |    generated by r.to.rast3                                               
|
 |                                                                          
|
 |   Comments:                                                              
|
 |    r.to.rast3 input="mapcalc_test_map_2_30960" output="g3d_test_map_2_3\ 
|
 |    0960"                                                                 
|
 |                                                                          
|
 +----------------------------------------------------------------------------+
Best regards
Soeren
Mon, Jun 26 2006 06:25:37    Mail sent by hamish_nospam@yahoo.com  
Return-Path <hamish_nospam@yahoo.com>
Delivered-To grass-bugs@lists.intevation.de
Date Mon, 26 Jun 2006 16:25:28 +1200
From Hamish <hamish_nospam@yahoo.com>
To Request Tracker <grass-bugs@intevation.de>
Cc grass-dev@grass.itc.it
Subject Re: [GRASS-dev] [bug #4725] (grass) nviz crashed while volume visualisation
Message-Id <20060626162528.08e80033.hamish_nospam@yahoo.com>
In-Reply-To <20060623173110.11CAF101F1B@lists.intevation.de>
References <20060623173110.11CAF101F1B@lists.intevation.de>
X-Mailer Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
X-Face M<EoB)"*Z~u!,vFhXmw}R_KbdBta*P_=T|rbBL'e1/CQ9;/1g\BU3&!=y8ria$2Uk!HT&BB 8i?|X_+7~1jsy}F~g$2va%3fV`*=L(*cem[@3\yg,G,@rg6/QMJ
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, hits=-1.236 tagged_above=-999 required=4 tests=[AWL=1.669, BAYES_00=-5, FORGED_YAHOO_RCVD=2.095]
X-Spam-Level
> this bug's URL: http://intevation.de/rt/webrt?serial_num=4725
> ---------------------------------------------------------------------
>
> Subject: nviz crashed while volume visualisation
..
> nviz produced a segfault while volume data visualisation.
> Im using the lates cvs build.
> 
> I have tested this with several locations. 
> gdb output of nviz within spearfish60 location:
..
> nviz volume=g3d_test_map_2_30960
..
> [r.info]
> r.to.rast3 input="mapcalc_test_map_2_30960" \
>  output="g3d_test_map_2_30960"


can you provide some commands to create test raster from standard
spearfish maps?

does it segfault on startup?

what about 'nviz -q' and then load from the Panel->Volume menu?


Hamish


Mon, Jun 26 2006 09:20:46    Mail sent by soerengebbert@gmx.de  
Return-Path <soerengebbert@gmx.de>
Delivered-To grass-bugs@lists.intevation.de
X-Authenticated #5818486
From Soeren Gebbert <soerengebbert@gmx.de>
To Hamish via RT <grass-bugs@intevation.de>
Subject Re: [bug #4725] (grass) nviz crashed while volume
Date Mon, 26 Jun 2006 09:20:34 +0200
User-Agent KMail/1.9.1
References <20060626042537.5F6681006AD@lists.intevation.de>
In-Reply-To <20060626042537.5F6681006AD@lists.intevation.de>
MIME-Version 1.0
Content-Type text/plain; charset="iso-8859-15"
Content-Transfer-Encoding 7bit
Content-Disposition inline
Message-Id <200606260920.34548.soerengebbert@gmx.de>
X-Y-GMX-Trusted 0
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, hits=-3.251 tagged_above=-999 required=4 tests=[AWL=1.749, BAYES_00=-5]
X-Spam-Level
Dear Hamish,
here are the examples:

#simple 3d raster data
g.region -d
g.region res=150 res3=150 t=80 b=0 tbres=10
r3.mapcalc "map3d=row()+col()+depth()"

#starting nviz with this data result in a segfault
nviz volume=map3d

With option -q nviz starts, if i add a voume everything is fine, but
if i try to create an isosurface nviz crashes.

gdb output below:

(gdb) r -q
Starting program: /usr/local/grass-6.1.cvs/bin/nviz -q
[Thread debugging using libthread_db enabled]
[New Thread -1225677120 (LWP 5717)]
[New Thread -1225679952 (LWP 5720)]
% BROWSER: .fbrowse TYPE: vol MODE: 1

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1225677120 (LWP 5717)]
gvl_read_char (pos=0, data=0x0) at gvl_calc.c:602
602     {
(gdb) bt
#0  gvl_read_char (pos=0, data=0x0) at gvl_calc.c:602
#1  0xb7f51db7 in gvld_vol (gvl=0x85fcdec) at gvld.c:38
#2  0xb7f4a6b9 in GVL_draw_vol (vid=0) at GVL2.c:287
#3  0x080661bd in vol_draw_all_cmd (data=0x8070f60, interp=0x807e710, argc=1,
argv=0xbf88c5fc) at togl_flythrough.c:752
#4  0x0806696d in Ndraw_all_together_cmd (data=0x8070f60, interp=0x807e710, argc=0,
argv=0x0) at togl_flythrough.c:798
#5  0xb7804b27 in TclInvokeStringCommand () from /usr/lib/libtcl8.4.so.0
#6  0xb780632a in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#7  0xb7807b56 in Tcl_EvalEx () from /usr/lib/libtcl8.4.so.0
#8  0xb78080d6 in Tcl_Eval () from /usr/lib/libtcl8.4.so.0
#9  0x08063a7e in display_cb (togl=0x0) at togl_cb.c:73
#10 0x08060a15 in Togl_Render (clientData=0x81df960) at togl.c:1167
#11 0xb7867c09 in TclServiceIdle () from /usr/lib/libtcl8.4.so.0
#12 0xb7856230 in Tcl_DoOneEvent () from /usr/lib/libtcl8.4.so.0
#13 0xb78f286d in Tk_TkwaitObjCmd () from /usr/lib/libtk8.4.so.0
#14 0xb780632a in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#15 0xb782ee09 in TclExprFloatError () from /usr/lib/libtcl8.4.so.0
#16 0xb7834f85 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
#17 0xb7860e98 in TclObjInterpProc () from /usr/lib/libtcl8.4.so.0
#18 0xb780632a in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#19 0xb78085f5 in Tcl_EvalObjv () from /usr/lib/libtcl8.4.so.0
#20 0xb7808978 in Tcl_EvalObjEx () from /usr/lib/libtcl8.4.so.0
#21 0xb7860680 in Tcl_UplevelObjCmd () from /usr/lib/libtcl8.4.so.0
#22 0xb780632a in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#23 0xb782ee09 in TclExprFloatError () from /usr/lib/libtcl8.4.so.0
#24 0xb7834f85 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
#25 0xb7860e98 in TclObjInterpProc () from /usr/lib/libtcl8.4.so.0
#26 0xb780632a in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#27 0xb7806460 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#28 0xb782ee09 in TclExprFloatError () from /usr/lib/libtcl8.4.so.0
#29 0xb7834f85 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
#30 0xb7860e98 in TclObjInterpProc () from /usr/lib/libtcl8.4.so.0
#31 0xb780632a in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#32 0xb782ee09 in TclExprFloatError () from /usr/lib/libtcl8.4.so.0
#33 0xb7834f85 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
#34 0xb7808924 in Tcl_EvalObjEx () from /usr/lib/libtcl8.4.so.0
#35 0xb791667e in TkInvokeButton () from /usr/lib/libtk8.4.so.0
#36 0xb7917840 in Tk_ButtonObjCmd () from /usr/lib/libtk8.4.so.0
#37 0xb780632a in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#38 0xb78085f5 in Tcl_EvalObjv () from /usr/lib/libtcl8.4.so.0
#39 0xb7808978 in Tcl_EvalObjEx () from /usr/lib/libtcl8.4.so.0
#40 0xb7860680 in Tcl_UplevelObjCmd () from /usr/lib/libtcl8.4.so.0
#41 0xb780632a in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#42 0xb782ee09 in TclExprFloatError () from /usr/lib/libtcl8.4.so.0
#43 0xb7834f85 in TclCompEvalObj () from /usr/lib/libtcl8.4.so.0
#44 0xb7860e98 in TclObjInterpProc () from /usr/lib/libtcl8.4.so.0
#45 0xb780632a in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#46 0xb7807b56 in Tcl_EvalEx () from /usr/lib/libtcl8.4.so.0
#47 0xb78080d6 in Tcl_Eval () from /usr/lib/libtcl8.4.so.0
#48 0xb7808c2c in Tcl_GlobalEval () from /usr/lib/libtcl8.4.so.0
#49 0xb78ef003 in Tk_BindEvent () from /usr/lib/libtk8.4.so.0
#50 0xb78f1de8 in TkBindEventProc () from /usr/lib/libtk8.4.so.0
#51 0xb78f944b in Tk_HandleEvent () from /usr/lib/libtk8.4.so.0
#52 0xb78f9cec in TkQueueEventForAllChildren () from /usr/lib/libtk8.4.so.0
#53 0xb7855e25 in Tcl_ServiceEvent () from /usr/lib/libtcl8.4.so.0
#54 0xb785610e in Tcl_DoOneEvent () from /usr/lib/libtcl8.4.so.0
#55 0xb78f9dad in Tk_MainLoop () from /usr/lib/libtk8.4.so.0
#56 0xb7906513 in Tk_MainEx () from /usr/lib/libtk8.4.so.0
#57 0x08060653 in main (argc=3, argv=0xbf88f7e4) at nvizMain.c:50


Best regards
Soeren



On Monday 26 June 2006 06:25, Hamish via RT wrote:
> > this bug's URL: http://intevation.de/rt/webrt?serial_num=4725
> > ---------------------------------------------------------------------
> >
> > Subject: nviz crashed while volume visualisation
> ..
> > nviz produced a segfault while volume data visualisation.
> > Im using the lates cvs build.
> > 
> > I have tested this with several locations. 
> > gdb output of nviz within spearfish60 location:
> ..
> > nviz volume=g3d_test_map_2_30960
> ..
> > [r.info]
> > r.to.rast3 input="mapcalc_test_map_2_30960" \
> >  output="g3d_test_map_2_30960"
> 
> 
> can you provide some commands to create test raster from standard
> spearfish maps?
> 
> does it segfault on startup?
> 
> what about 'nviz -q' and then load from the Panel->Volume menu?
> 
> 
> Hamish
> 
> 
> --- Headers Follow ---
> 
> >From hamish_nospam@yahoo.com  Mon Jun 26 06:25:37 2006
> Return-Path: <hamish_nospam@yahoo.com>
> Delivered-To: grass-bugs@lists.intevation.de
> Received: from kolab.intevation.de (aktaia [212.95.126.10])
> 	by lists.intevation.de (Postfix) with ESMTP id 016F71006AA
> 	for <grass-bugs@lists.intevation.de>; Mon, 26 Jun 2006 06:25:36 +0200 (CEST)
> Received: from localhost (localhost.localdomain [127.0.0.1])
> 	by kolab.intevation.de (Postfix) with ESMTP id B5DFF164844
> 	for <grass-bugs@lists.intevation.de>; Mon, 26 Jun 2006 06:25:36 +0200 (CEST)
> Received: from localhost (localhost.localdomain [127.0.0.1])
> 	by kolab.intevation.de (Postfix) with ESMTP id 97C8B142CE2
> 	for <grass-bugs@lists.intevation.de>; Mon, 26 Jun 2006 06:25:36 +0200 (CEST)
> Received: from mail.intevation.de (kymodoke.hq [192.168.11.1])
> 	by kolab.intevation.de (Postfix) with ESMTP id 6B553142C92
> 	for <grass-bugs@kolab.intevation.de>; Mon, 26 Jun 2006 06:25:36 +0200 (CEST)
> Received: from localhost (localhost [127.0.0.1])
> 	by mail.intevation.de (Postfix) with ESMTP id 1D01737328
> 	for <grass-bugs@kolab.intevation.de>; Mon, 26 Jun 2006 06:25:36 +0200 (CEST)
> Received: from mailhub1.otago.ac.nz (mailhub1.otago.ac.nz [139.80.64.218])
> 	by mail.intevation.de (Postfix) with ESMTP id 1753237016
> 	for <grass-bugs@intevation.de>; Mon, 26 Jun 2006 06:25:34 +0200 (CEST)
> Received: from galadriel.otago.ac.nz (galadriel.otago.ac.nz [139.80.64.213])
> 	by mailhub1.otago.ac.nz (8.13.6/8.13.6) with ESMTP id k5Q4PSug010509;
> 	Mon, 26 Jun 2006 16:25:28 +1200
> Received: from taihua.otago.ac.nz ([139.80.35.27] helo=taihua)
> 	by galadriel.otago.ac.nz with smtp (Exim 4.50)
> 	id 1Fuif9-0004sf-12; Mon, 26 Jun 2006 16:25:27 +1200
> Date: Mon, 26 Jun 2006 16:25:28 +1200
> From: Hamish <hamish_nospam@yahoo.com>
> To: Request Tracker <grass-bugs@intevation.de>
> Cc: grass-dev@grass.itc.it
> Subject: Re: [GRASS-dev] [bug #4725] (grass) nviz crashed while volume
>  visualisation
> Message-Id: <20060626162528.08e80033.hamish_nospam@yahoo.com>
> In-Reply-To: <20060623173110.11CAF101F1B@lists.intevation.de>
> References: <20060623173110.11CAF101F1B@lists.intevation.de>
> X-Mailer: Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
> X-Face: M<EoB)"*Z~u!,vFhXmw}R_KbdBta*P_=T|rbBL'e1/CQ9;/1g\BU3&!=y8ria$2Uk!HT&BB
>  8i?|X_+7~1jsy}F~g$2va%3fV`*=L(*cem[@3\yg,G,@rg6/QMJ
> Mime-Version: 1.0
> Content-Type: text/plain; charset=US-ASCII
> Content-Transfer-Encoding: 7bit
> X-Virus-Scanned: by amavisd-new at intevation.de
> X-Spam-Status: No, hits=-1.236 tagged_above=-999 required=4 tests=[AWL=1.669,
>  BAYES_00=-5, FORGED_YAHOO_RCVD=2.095]
> X-Spam-Level: 
> 
> -------------------------------------------- Managed by Request Tracker
> 
> 


Wed, Jun 28 2006 09:52:16    Mail sent by hbowman  
Ok, thanks. I get the segfault too.

you might want to use g.region -a:
g.region res=150 res3=150 t=80 b=0 tbres=10 -a


backtraces are not wonderfully useful for TclTk+C modules unfortunately,
you've got to puts() and printf() your way through to track down where it breaks.
If you edit the top of $GISBASE/etc/nviz2.2/scripts/nviz2.2_script  and
set DEBUG 1

you'll see some more debug messages which will tell you how far you got.


Hamish
Wed, Jun 28 2006 10:07:20    Mail sent by hbowman  
for once it fails with TclTk 8.3 as well, so it isn't the ususal memory error.
It gets this far:

GRASS 6.1> nviz volume=map3d
Adding panels from [$GISBASE]/etc/nviz2.2/scripts
Nv_(panels)
Build toplevel window
toplevel made
info widget made
panel area made
file menu made
Help menu made
disabled made
Nv_mkPanelMenu 1
Nv_mkPanelMenu 2 0
Nv_mkPanelMenu 2 1
Nv_mkPanelMenu 2 2
% Segmentation fault


Hamish
Wed, Jun 28 2006 12:13:10    Mail sent by hbowman  
[ https://intevation.de/rt/webrt?serial_num=4725 ]

Hi,

"nviz volume=map3d" segfaults.. see bug report for spearfish example.


I've traced it back to incorrect mode in  nviz/src/volume.c
slice_get_drawmode()

mode=1969841253 (or so)
when it should be like DM_GOURAUD=256 or DM_FLAT=512

actual segfault seems to happen after slice_get_drawmode()'s
return (TCL_ERROR);
???

called from scripts/panel_vol.tcl line ~450:
    set Nv_(ShadeStyle) [Nvol$curr slice get_drawmode]



I followed "mode" into lib/ogsf/GVL2.c GVL_slice_get_drawmode()
and then *gvl to gvl_get_vol() in lib/ogsf/gvl.c, but then I get lost.


uninit'd variable?


Hamish
Wed, Jul 5 2006 17:14:58    Comments added by mneteler  
On Thu, Jul 06, 2006 at 03:02:45AM +1200, Hamish wrote:
> Helena wrote:
> > Some modules have problems running on 64bit (maybe that is also #4725?
>
> 4725 (NVIZ segfaults with volumes) happens for me on a 32-bit P4 using
> both TclTk 8.3 and 8.4.
>
> https://intevation.de/rt/webrt?serial_num=4725
Sun, Jul 9 2006 16:17:21    Mail sent by soerengebbert@gmx.de  
Return-Path <soerengebbert@gmx.de>
Delivered-To grass-bugs@lists.intevation.de
X-Authenticated #5818486
From Soeren Gebbert <soerengebbert@gmx.de>
To Harmish Bowman via RT <grass-bugs@intevation.de>
Subject Re: [bug #4725] (grass) nviz crashed while volume visualisation
Date Sun, 9 Jul 2006 16:17:16 +0200
User-Agent KMail/1.9.1
Cc grass-dev@grass.itc.it
References <20060628101310.A6E971005BB@lists.intevation.de>
In-Reply-To <20060628101310.A6E971005BB@lists.intevation.de>
MIME-Version 1.0
Content-Type text/plain; charset="iso-8859-15"
Content-Transfer-Encoding 7bit
Content-Disposition inline
Message-Id <200607091617.17441.soerengebbert@gmx.de>
X-Y-GMX-Trusted 0
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, hits=-3.625 tagged_above=-999 required=4 tests=[AWL=1.375, BAYES_00=-5]
X-Spam-Level
Hi,
On Wednesday 28 June 2006 12:13, Harmish Bowman via RT wrote:
> [ https://intevation.de/rt/webrt?serial_num=4725 ]

> Hi,

> "nviz volume=map3d" segfaults.. see bug report for spearfish example.

> I've traced it back to incorrect mode in  nviz/src/volume.c
> 
> slice_get_drawmode()

> 
> mode=1969841253 (or so)
> 
> when it should be like DM_GOURAUD=256 or DM_FLAT=512

> actual segfault seems to happen after slice_get_drawmode()'s
> 
> return (TCL_ERROR);
> 
> ???

> 
> called from scripts/panel_vol.tcl line ~450:
> 
>     set Nv_(ShadeStyle) [Nvol$curr slice get_drawmode]

> I followed "mode" into lib/ogsf/GVL2.c GVL_slice_get_drawmode()
> 
> and then *gvl to gvl_get_vol() in lib/ogsf/gvl.c, but then I get lost.

> uninit'd variable?
> Hamish

Looks like. 
If nviz is called with -q and a volume + isosurfaces are added -> nviz segfaults.
I have corrected the uninitialized variable:

cvs server: Diffing .
Index: gvl_calc.c
===================================================================
RCS file: /home/grass/grassrepository/grass6/lib/ogsf/gvl_calc.c,v
retrieving revision 1.3
diff -u -r1.3 gvl_calc.c
--- gvl_calc.c  9 Feb 2006 03:08:57 -0000       1.3
+++ gvl_calc.c  9 Jul 2006 13:48:54 -0000
@@ -444,7 +444,7 @@
 {
     int x, y, z;
     int i, a, read;
-    geovol_file *vf;
+    geovol_file *vf = NULL;
     geovol_isosurf *isosurf;

     data_buffer *dbuff;


and it works for me now. But i am not sure if this realy fixed the
problem. 

But there is a second problem. If i start nviz with the option "volume" 
and a valid volume map e.g.: nviz volume=vol
nviz receives a segmentation fault. This seems to be related to this line: 

/home/grass/grassrepository/grass6/visualization/nviz/src/togl_flythrough.c:786
buf_vol = Tcl_GetVar(interp, "volume", TCL_GLOBAL_ONLY);

buf_vol is a NULL pointer and the program segfaults while the atoi(buf_*) calls
later.

Something realy strange happens here if a volume map is provided. Maybe the parsing
functionality for volume maps is broken?

I have no clue where this functionality is defined, so i'm not able to fix this.
:(

Best
Soeren


Sun, Jul 9 2006 23:01:03    Mail sent by glynn@gclements.plus.com  
Return-Path <glynn@gclements.plus.com>
Delivered-To grass-bugs@lists.intevation.de
From Glynn Clements <glynn@gclements.plus.com>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Message-ID <17585.28285.267945.416942@cerise.gclements.plus.com>
Date Sun, 9 Jul 2006 22:00:45 +0100
To Soeren Gebbert <soerengebbert@gmx.de>
Cc Harmish Bowman via RT <grass-bugs@intevation.de>, grass-dev@grass.itc.it
Subject Re: [GRASS-dev] Re: [bug #4725] (grass) nviz crashed while volume visualisation
In-Reply-To <200607091617.17441.soerengebbert@gmx.de>
References <20060628101310.A6E971005BB@lists.intevation.de> <200607091617.17441.soerengebbert@gmx.de>
X-Mailer VM 7.07 under 21.4 (patch 15) "Security Through Obscurity" XEmacs Lucid
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, hits=-3.389 tagged_above=-999 required=4 tests=[AWL=1.345, BAYES_00=-5, FORGED_RCVD_HELO=0.266]
X-Spam-Level
Soeren Gebbert wrote:

> > and then *gvl to gvl_get_vol() in lib/ogsf/gvl.c, but then I get lost.
> 
> > uninit'd variable?
> > Hamish
> 
> Looks like. 
> If nviz is called with -q and a volume + isosurfaces are added -> nviz segfaults.
> I have corrected the uninitialized variable:
> 
> cvs server: Diffing .
> Index: gvl_calc.c
> ===================================================================
> RCS file: /home/grass/grassrepository/grass6/lib/ogsf/gvl_calc.c,v
> retrieving revision 1.3
> diff -u -r1.3 gvl_calc.c
> --- gvl_calc.c  9 Feb 2006 03:08:57 -0000       1.3
> +++ gvl_calc.c  9 Jul 2006 13:48:54 -0000
> @@ -444,7 +444,7 @@
>  {
>      int x, y, z;
>      int i, a, read;
> -    geovol_file *vf;
> +    geovol_file *vf = NULL;
>      geovol_isosurf *isosurf;
> 
>      data_buffer *dbuff;
> 
> 
> and it works for me now. But i am not sure if this realy fixed the
> problem. 

I don't think so. In that function (gvl_isosurf_calc), "vf" is only
read if the variable "read" is non-zero. But the only places which set
"read" also set "vf":

-- 
Glynn Clements <glynn@gclements.plus.com>


Wed, Aug 2 2006 21:54:06    Mail sent by mneteler  
Hi,

[ http://intevation.de/rt/webrt?serial_num=4725 ]

I just tested the volume with the Slovakia3D dataset:
it works again. Whatever happened, but NVIZ volume
visualization seems to be back.

GRASS 6.1.cvs (slovakia3d):~ >  nviz dem500 volume=precip3d.500z50
Loading Data
Update elev null mask
Loading Data
translating colors from fp
recalculating normals...
% [Raster MASK present]
GRASS 6.1.cvs (slovakia3d):~ >

Someone please test this with 6.1.0RC1. Enter Panel -> volume
-> add -> constant -> 1000 to visualize an isosurface. Or
read the README of the dataset.

Markus
Wed, Aug 2 2006 23:34:07    Mail sent by neteler@itc.it  
Return-Path <neteler@itc.it>
Delivered-To grass-bugs@lists.intevation.de
Date Wed, 2 Aug 2006 23:33:40 +0200
From Markus Neteler <neteler@itc.it>
To Markus Neteler via RT <grass-bugs@intevation.de>
Cc grass-dev@grass.itc.it
Subject Re: [GRASS-dev] [bug #4725] (grass) nviz crashed while volume visualisation
Message-ID <20060802213340.GI15803@bartok.itc.it>
Mail-Followup-To Markus Neteler via RT <grass-bugs@intevation.de>, grass-dev@grass.itc.it
References <20060802195406.E092E101EE6@lists.intevation.de>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
In-Reply-To <20060802195406.E092E101EE6@lists.intevation.de>
X-PGP-Key http://www.gdf-hannover.de/neteler/markus_gpgkey.asc
X-PGP-Fingerprint D4D5 2F80 120E AD60 E2F6 2297 21B3 D02B E1E7 E789
User-Agent Mutt/1.5.11
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, hits=-3.887 tagged_above=-999 required=3 tests=[AWL=0.847, BAYES_00=-5, FORGED_RCVD_HELO=0.266]
X-Spam-Level
On Wed, Aug 02, 2006 at 09:54:06PM +0200, Markus Neteler via RT wrote:
> Hi,
> 
> [ http://intevation.de/rt/webrt?serial_num=4725 ]
> 
> I just tested the volume with the Slovakia3D dataset:
> it works again. Whatever happened, but NVIZ volume
> visualization seems to be back.
> 
> GRASS 6.1.cvs (slovakia3d):~ >  nviz dem500 volume=precip3d.500z50
> Loading Data
> Update elev null mask
> Loading Data
> translating colors from fp
> recalculating normals...
> % [Raster MASK present]
> GRASS 6.1.cvs (slovakia3d):~ >
> 
> Someone please test this with 6.1.0RC1. Enter Panel -> volume
> -> add -> constant -> 1000 to visualize an isosurface. Or
> read the README of the dataset.
> 

Ok, it crashed in a second run.

I debugged a problem in togl_flythrough.c, line 800:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1239013664 (LWP 24023)]
0xb734e327 in __strtouq_internal () from /lib/tls/libc.so.6
(gdb) bt full
#0  0xb734e327 in __strtouq_internal () from /lib/tls/libc.so.6
No symbol table info available.
#1  0xb734e0cf in __strtol_internal () from /lib/tls/libc.so.6
No symbol table info available.
#2  0xb7a2f2d0 in atoi (__nptr=0x0) at /usr/include/stdlib.h:333
No locals.
#3  0x08068d93 in Ndraw_all_together_cmd (data=0x8073f40, interp=0x8079b18, argc=1,
argv=0xbf8a89ec)
    at togl_flythrough.c:800
        buf_surf = 0x0
        buf_vect = 0x0
        buf_site = 0x0
        buf_vol = 0x0
        buf_north_arrow = 0x0
        arrow_x = 0x0
        buf_label = 0x0
        buf_legend = 0x0
        buf_fringe = 0x0
        buf_is_drawing = 0x0
#4  0xb76e3c86 in TclInvokeStringCommand () from /usr/lib/libtcl8.4.so
No symbol table info available.
#5  0x08073f40 in script_mode ()
No symbol table info available.
#6  0x08079b18 in ?? ()
No symbol table info available.


Since all the buf_xxx stuff is 0x0, atoi() crashes.
Not sure if this is related to the recent togl changes.

Markus


Thu, Aug 3 2006 00:48:16    Mail sent by glynn@gclements.plus.com  
Return-Path <glynn@gclements.plus.com>
Delivered-To grass-bugs@lists.intevation.de
From Glynn Clements <glynn@gclements.plus.com>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Message-ID <17617.11180.340937.124047@cerise.gclements.plus.com>
Date Wed, 2 Aug 2006 23:48:12 +0100
To Markus Neteler <neteler@itc.it>
Cc Markus Neteler via RT <grass-bugs@intevation.de>, grass-dev@grass.itc.it
Subject Re: [GRASS-dev] [bug #4725] (grass) nviz crashed while volume visualisation
In-Reply-To <20060802213340.GI15803@bartok.itc.it>
References <20060802195406.E092E101EE6@lists.intevation.de> <20060802213340.GI15803@bartok.itc.it>
X-Mailer VM 7.07 under 21.4 (patch 15) "Security Through Obscurity" XEmacs Lucid
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, hits=-3.602 tagged_above=-999 required=3 tests=[AWL=1.132, BAYES_00=-5, FORGED_RCVD_HELO=0.266]
X-Spam-Level
Markus Neteler wrote:

> > [ http://intevation.de/rt/webrt?serial_num=4725 ]
> > 
> > I just tested the volume with the Slovakia3D dataset:
> > it works again. Whatever happened, but NVIZ volume
> > visualization seems to be back.
> > 
> > GRASS 6.1.cvs (slovakia3d):~ >  nviz dem500 volume=precip3d.500z50
> > Loading Data
> > Update elev null mask
> > Loading Data
> > translating colors from fp
> > recalculating normals...
> > % [Raster MASK present]
> > GRASS 6.1.cvs (slovakia3d):~ >
> > 
> > Someone please test this with 6.1.0RC1. Enter Panel -> volume
> > -> add -> constant -> 1000 to visualize an isosurface. Or
> > read the README of the dataset.
> 
> Ok, it crashed in a second run.
> 
> I debugged a problem in togl_flythrough.c, line 800:
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread -1239013664 (LWP 24023)]
> 0xb734e327 in __strtouq_internal () from /lib/tls/libc.so.6
> (gdb) bt full
> #0  0xb734e327 in __strtouq_internal () from /lib/tls/libc.so.6
> No symbol table info available.
> #1  0xb734e0cf in __strtol_internal () from /lib/tls/libc.so.6
> No symbol table info available.
> #2  0xb7a2f2d0 in atoi (__nptr=0x0) at /usr/include/stdlib.h:333
> No locals.
> #3  0x08068d93 in Ndraw_all_together_cmd (data=0x8073f40, interp=0x8079b18,
argc=1, argv=0xbf8a89ec)
>     at togl_flythrough.c:800
>         buf_surf = 0x0
>         buf_vect = 0x0
>         buf_site = 0x0
>         buf_vol = 0x0
>         buf_north_arrow = 0x0
>         arrow_x = 0x0
>         buf_label = 0x0
>         buf_legend = 0x0
>         buf_fringe = 0x0
>         buf_is_drawing = 0x0
> #4  0xb76e3c86 in TclInvokeStringCommand () from /usr/lib/libtcl8.4.so
> No symbol table info available.
> #5  0x08073f40 in script_mode ()
> No symbol table info available.
> #6  0x08079b18 in ?? ()
> No symbol table info available.
> 
> 
> Since all the buf_xxx stuff is 0x0, atoi() crashes.
> Not sure if this is related to the recent togl changes.

It might be related to the new version of Togl. Or a different version
of Tcl/Tk, or some other change to NVIZ.

The problem is that the Togl canvas is being redrawn before the
variables have been created. As the canvas can be redrawn at any point
after it has been created (or even during creation), it is necessary
to initialise all of the above variables before creating the canvas.

Whilst creating them later and simply hoping that the canvas won't get
redrawn first might work, it's an extremely fragile "solution".

-- 
Glynn Clements <glynn@gclements.plus.com>


Thu, Aug 3 2006 21:04:20    Mail sent by mneteler  
Glann,

to me it is not entirely clear how to implement your
suggestion...

Markus
Fri, Aug 4 2006 00:09:36    Mail sent by glynn@gclements.plus.com  
Return-Path <glynn@gclements.plus.com>
Delivered-To grass-bugs@lists.intevation.de
From Glynn Clements <glynn@gclements.plus.com>
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Message-ID <17618.29720.351373.670133@cerise.gclements.plus.com>
Date Thu, 3 Aug 2006 23:09:28 +0100
To Markus Neteler via RT <grass-bugs@intevation.de>
Cc soerengebbert@gmx.de, grass-dev@grass.itc.it
Subject Re: [GRASS-dev] [bug #4725] (grass) nviz crashed while volume visualisation
In-Reply-To <20060803190420.0FC961006CC@lists.intevation.de>
References <20060803190420.0FC961006CC@lists.intevation.de>
X-Mailer VM 7.07 under 21.4 (patch 15) "Security Through Obscurity" XEmacs Lucid
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, hits=-3.61 tagged_above=-999 required=3 tests=[AWL=1.124, BAYES_00=-5, FORGED_RCVD_HELO=0.266]
X-Spam-Level
Markus Neteler via RT wrote:

> to me it is not entirely clear how to implement your
> suggestion...

The variables are initially set in mkmainPanel in panel_main.tcl.

The top-level of nviz2.2_script calls Nv_makeGUI, which calls
"Nv_openPanel main 0", which calls mkmainPanel. However, Nv_makeGUI
creates the Togl widget early on, and the main panel much later. If
anything causes a redraw inbetween, you will get the error which you
report.

Either the creation of the Togl canvas needs to be delayed until
/everything/ required by the redraw handler has been done, or the
redraw handler needs to be made more robust so that it at least
doesn't crash if it gets called too early.

At a minimum, you can fix the specific crash by protecting all of the
atoi() calls in Ndraw_all_together_cmd() with checks to ensure that
their arguments (obtained from Tcl_GetVar) are non-NULL, e.g.

-	if (atoi(buf_surf) == 1)
+	if (buf_surf && atoi(buf_surf) == 1)

Or move all of the Tcl_GetVar() calls to the top of the function and
add a single check, i.e.:

	if (!buf_surf || !buf_vect || ... )
		return (TCL_OK);

-- 
Glynn Clements <glynn@gclements.plus.com>


Fri, Aug 4 2006 09:15:06    Mail sent by mneteler  
Soeren,

I have patched togl_flythrough.c as suggested (first suggestion).
Can you please try it?

Markus
Fri, Aug 4 2006 11:41:19    Mail sent by soerengebbert@gmx.de  
Return-Path <soerengebbert@gmx.de>
Delivered-To grass-bugs@lists.intevation.de
X-Authenticated #5818486
From Soeren Gebbert <soerengebbert@gmx.de>
To Markus Neteler via RT <grass-bugs@intevation.de>
Subject Re: [bug #4725] (grass) nviz crashed while volume visualisation
Date Fri, 4 Aug 2006 11:41:10 +0200
User-Agent KMail/1.9.1
References <20060804071506.560971006DF@lists.intevation.de>
In-Reply-To <20060804071506.560971006DF@lists.intevation.de>
MIME-Version 1.0
Content-Type text/plain; charset="iso-8859-15"
Content-Transfer-Encoding 7bit
Content-Disposition inline
Message-Id <200608041141.10752.soerengebbert@gmx.de>
X-Y-GMX-Trusted 0
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, hits=-3.78 tagged_above=-999 required=3 tests=[AWL=0.954, BAYES_00=-5, FORGED_RCVD_HELO=0.266]
X-Spam-Level
On Friday 04 August 2006 09:15, Markus Neteler via RT wrote:
> Soeren,
> 
> 
> 
> I have patched togl_flythrough.c as suggested (first suggestion).
> 
> Can you please try it?

Yes i can, but the result is the same as bevor. :(
I made a distclean, cvs up -dP and compiled grass from scratch.
This is the result:

Mapset <PERMANENT> in Location <LausanneDemoData>                           
GRASS 6.1.cvs > gdb `which nviz`
GNU gdb 6.4.90-debian

(gdb) r volume=geology
Starting program: /usr/local/grass-6.1.cvs/bin/nviz volume=geology
[Thread debugging using libthread_db enabled]
[New Thread -1225705792 (LWP 23785)]
[New Thread -1225708624 (LWP 23788)]
%
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1225705792 (LWP 23785)]
0xb7484b66 in __strtouq_internal () from /lib/tls/libc.so.6
(gdb) bt
#0  0xb7484b66 in __strtouq_internal () from /lib/tls/libc.so.6
#1  0xb748490f in __strtol_internal () from /lib/tls/libc.so.6
#2  0x080667f5 in Ndraw_all_together_cmd (data=0x80710a0, interp=0x0, argc=10,
argv=0xa)
    at /usr/include/stdlib.h:333
#3  0xb77f7e6c in TclInvokeStringCommand () from /usr/lib/libtcl8.4.so.0
#4  0xb77f9931 in TclEvalObjvInternal () from /usr/lib/libtcl8.4.so.0
#5  0xb77f9edd in Tcl_EvalEx () from /usr/lib/libtcl8.4.so.0
#6  0xb77fa1eb in Tcl_Eval () from /usr/lib/libtcl8.4.so.0
#7  0x08063bce in display_cb (togl=0xa) at togl_cb.c:73
#8  0x08060b65 in Togl_Render (clientData=0xb7882510) at togl.c:1163
#9  0xb785c44f in TclServiceIdle () from /usr/lib/libtcl8.4.so.0
#10 0xb784ab30 in Tcl_DoOneEvent () from /usr/lib/libtcl8.4.so.0
#11 0xb7916d5d in Tk_FrameObjCmd () from /usr/lib/libtk8.4.so.0
#12 0xb785c44f in TclServiceIdle () from /usr/lib/libtcl8.4.so.0
#13 0xb784ab30 in Tcl_DoOneEvent () from /usr/lib/libtcl8.4.so.0
#14 0xb78f0dad in Tk_MainLoop () from /usr/lib/libtk8.4.so.0
#15 0xb78fd513 in Tk_MainEx () from /usr/lib/libtk8.4.so.0
#16 0x080607a3 in main (argc=3, argv=0xbfb47584) at nvizMain.c:50
(gdb)


I dont think that the patch will work, because atoi does not detect errors.
You have to check if the argument of atoi is null. 
Maybe a better way is to use sscanf, well you will have to check if the argument
is null too,  
but sscanf will tell you if the conversion was successfull or not:

char *arg = some_string;
int value;

if(arg != NULL)
  if(sscanf(arg, "%i", &value))
	printf("Everything is fine");
  else
	printf("Something is wrong")

Best regards
Soeren

> 
> 
> 
> Markus
> 
> -------------------------------------------- Managed by Request Tracker
> 
> 


Wed, Aug 16 2006 11:43:42    Mail sent by mneteler  
Hi,

atoi is checked now, does it work?

Markus
Wed, Aug 23 2006 09:22:44    Mail sent by hamish_nospam@yahoo.com  
Return-Path <hamish_nospam@yahoo.com>
Delivered-To grass-bugs@lists.intevation.de
Date Wed, 23 Aug 2006 19:22:26 +1200
From Hamish <hamish_nospam@yahoo.com>
To Markus Neteler <neteler@itc.it>, Glynn Clements <glynn@gclements.plus.com>
Cc grass-dev@grass.itc.it, grass-bugs@intevation.de
Subject Re: [bug #4725] [GRASS-dev] still togl problems in NVIZ for volume
Message-Id <20060823192226.30686d25.hamish_nospam@yahoo.com>
In-Reply-To <20060822195610.GA1033@bartok.itc.it>
References <C1108A04.23BB1%michael.barton@asu.edu> <EB2BCEC3-F432-43A6-91CB-E1C6E7ED00D4@kyngchaos.com> <20060822195610.GA1033@bartok.itc.it>
X-Mailer Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
X-Face M<EoB)"*Z~u!,vFhXmw}R_KbdBta*P_=T|rbBL'e1/CQ9;/1g\BU3&!=y8ria$2Uk!HT&BB 8i?|X_+7~1jsy}F~g$2va%3fV`*=L(*cem[@3\yg,G,@rg6/QMJ
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, hits=-1.518 tagged_above=-999 required=3 tests=[AWL=0.782, BAYES_00=-5, FORGED_YAHOO_RCVD=2.7]
X-Spam-Level
Markus wrote:
> With tcltk <= 8.4.11 it crashes :-( Tested on RHEL4 and Mandriva2006.

latest 6.3-cvs on Debian/sarge with tcltk 8.4 [threaded] it crashes when
I try to [Add] a new isosurface. First time I tried it happened when
adding the 3rd isosurface, second time it segfaulted on the first surface.

I found this earlier:

=========================

from  https://intevation.de/rt/webrt?serial_num=4725

Wed, Jun 28 2006 12:13:10 	   	Mail sent by hbowman 	 


Hi,

"nviz volume=map3d" segfaults.. see bug report for spearfish example.


I've traced it back to incorrect mode in  nviz/src/volume.c
slice_get_drawmode()

mode=1969841253 (or so)
when it should be like DM_GOURAUD=256 or DM_FLAT=512

actual segfault seems to happen after slice_get_drawmode()'s
return (TCL_ERROR);
???

called from scripts/panel_vol.tcl line ~450:
    set Nv_(ShadeStyle) [Nvol$curr slice get_drawmode]



I followed "mode" into lib/ogsf/GVL2.c GVL_slice_get_drawmode()
and then *gvl to gvl_get_vol() in lib/ogsf/gvl.c, but then I get lost.


uninit'd variable?


Hamish



> Markus Neteler wrote:
> 
> > > With tcltk <= 8.4.11 it crashes :-( Tested on RHEL4 and
> > > Mandriva2006.
> > 
> > On Mandriva2006 it crashes like this:
> > 
> > Program received signal SIGSEGV, Segmentation fault.
> > [Switching to Thread -1238534432 (LWP 24083)]
> > 0xb7fa09d7 in gvl_read_char (pos=0, data=0x0) at gvl_calc.c:602
> > 602     {
> > (gdb) bt full
> > #0  0xb7fa09d7 in gvl_read_char (pos=0, data=0x0) at gvl_calc.c:602
> > No locals.
> > #1  0xb7fa1a17 in gvld_isosurf (gvl=0x8158d78) at gvld.c:248
> >         tx = 0.00224719103
> >         ty = 0.00224719103
> >         tz = 0.0224719103
> >         cols = 593
> >         rows = 340
> >         depths = 4
> >         x = 0
> >         y = 0
> >         z = 0
> >         i = Variable "i" is not available.
> 
> Both of these reports have a NULL data field in the geovol_isosurf
> structure. This field is NULL when the structure is initially created,
> and initialised by gvl_isosurf_calc() (gvl_calc.c:542).
> 
> gvld_vol() calls gvl_isosurf_calc() before calling gvld_isosurf(), so
> it appears that gvl_isosurf_calc() is failing to initialise the field
> for some reason.
> 
> I can only suggest single-stepping through gvl_isosurf_calc() to try
> to figure out why the field doesn't get set.
> 
> So far as trying to comprehend that code is concerned, fixing the
> formatting would probably help, as would fixing the macros at the top
> of that file so that they don't refer to local variables.
> 
> -- 
> Glynn Clements <glynn@gclements.plus.com>
> 
> _______________________________________________
> grass-dev mailing list
> grass-dev@grass.itc.it
> http://grass.itc.it/mailman/listinfo/grass-dev


Mon, Oct 16 2006 06:33:58    Mail sent by hamish_nospam@yahoo.com  
Return-Path <hamish_nospam@yahoo.com>
Delivered-To grass-bugs@lists.intevation.de
Date Mon, 16 Oct 2006 17:33:40 +1300
From Hamish <hamish_nospam@yahoo.com>
To grass5 <grass-dev@grass.itc.it>
Cc grass-bugs@intevation.de, hmitaso@unity.ncsu.edu
Subject Re: [bug #4725] "nviz vol=raster3d" lockup
Message-Id <20061016173340.163967e0.hamish_nospam@yahoo.com>
X-Mailer Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
X-Face M<EoB)"*Z~u!,vFhXmw}R_KbdBta*P_=T|rbBL'e1/CQ9;/1g\BU3&!=y8ria$2Uk!HT&BB 8i?|X_+7~1jsy}F~g$2va%3fV`*=L(*cem[@3\yg,G,@rg6/QMJ
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, hits=-2.3 tagged_above=-999 required=3 tests=[BAYES_00=-5, FORGED_YAHOO_RCVD=2.7]
X-Spam-Level
NVIZ 3D raster volume works ok if loaded with:

nviz -q
Panel->Raster volumes
Add, etc.

but locks up NVIZ while setting up the menus (panel->volumes).

I can trace it through the following: the problem seems to be in the 
C -> Tcl transition after the C parts have done their thing and try to
return the result. It only seems to fail when result=TCL_ERROR (ie 1),
so maybe a symptom of some other corruption)


[nviz2.2_script]
Nv_mkPanelMenu

[vol.tcl]
mkvolPanel
  create_isosurfs_subpanel
    update_isosurfs_subpanel
      set Nv_(ShadeStyle) [Nvol$curr isosurf get_drawmode]

[visualization/nviz/src/map_obj.c]
  Nmap_obj_cmd()
    isosurf()

[visualization/nviz/src/volume.c]
int isosurf_get_drawmode() {
  [...]
      else {
	Tcl_SetResult(interp,
              "Internal Error: unknown shade style returned in get_drawmode",
TCL_VOLATILE);
    return (TCL_ERROR);
    }


it locks when Nv_mkPanelMenu() returns a value of 1 to update_isosurfs_subpanel.
[src/map_obj.c  MODIFIED]
...
    else if (!strcmp(argv[1], "isosurf"))
{
int val;
val = isosurf(id, type, interp, argc, argv);
printf("==> val= %d\n", val);
fflush(stdout);
    return (val);
}

shows that isosurf() worked ok.



???
Hamish


Mon, Oct 16 2006 06:35:18    Comments added by hbowman  
that's with tcltk 8.3 on debian/sarge (stable)


Hamish
Mon, Oct 16 2006 08:13:35    Mail sent by hamish_nospam@yahoo.com  
Return-Path <hamish_nospam@yahoo.com>
Delivered-To grass-bugs@lists.intevation.de
Date Mon, 16 Oct 2006 19:13:14 +1300
From Hamish <hamish_nospam@yahoo.com>
To grass-dev@grass.itc.it
Cc hmitaso@unity.ncsu.edu, grass-bugs@intevation.de
Subject Re: [GRASS-dev] Re: [bug #4725] "nviz vol=raster3d" lockup
Message-Id <20061016191314.12d3caab.hamish_nospam@yahoo.com>
In-Reply-To <20061016173340.163967e0.hamish_nospam@yahoo.com>
References <20061016173340.163967e0.hamish_nospam@yahoo.com>
X-Mailer Sylpheed version 1.0.4 (GTK+ 1.2.10; i386-pc-linux-gnu)
X-Face M<EoB)"*Z~u!,vFhXmw}R_KbdBta*P_=T|rbBL'e1/CQ9;/1g\BU3&!=y8ria$2Uk!HT&BB 8i?|X_+7~1jsy}F~g$2va%3fV`*=L(*cem[@3\yg,G,@rg6/QMJ
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Virus-Scanned by amavisd-new at intevation.de
X-Spam-Status No, hits=-2.3 tagged_above=-999 required=3 tests=[BAYES_00=-5, FORGED_YAHOO_RCVD=2.7]
X-Spam-Level
Hamish wrote:
> NVIZ 3D raster volume works ok if loaded with:
> 
> nviz -q
> Panel->Raster volumes
> Add, etc.
> 
> but locks up NVIZ while setting up the menus (panel->volumes).


that should be:

but locks up if NVIZ is started from the command line with
  nviz volume=raster_map3d

The freeze happens while setting up the menus (panel->volumes).


Hamish


Mon, Nov 20 2006 06:30:50    Comments added by hbowman  
Subject: Re: [GRASS-dev] [bug #4725] NVIZ now broken?
Date: Mon, 20 Nov 2006
To: Bob Covill <bcovill tekmap ns ca>

Bob Covill wrote:
> Hello,
> 
> I have been looking into why nviz fails when loading a volume from the
> command line (i.e. nviz vol=precip3d.500z50). This is the bug reported
> in 
> http://intevation.de/rt/webrt?serial_num=4725
> 
> It appears that the volume drawmode is not initialized which causes
> the GUI to hang when loading the volume panel. The attached patch for
> map_obj.c in nviz/src should fix this. 


Hi,

still some problems for me :-/

debian/stable, tcltk 8.3, 32bit Pentium 4. Working with 6.2.0 source.
This doesn't add the complication of new & untested tcl code (so
Markus's patch isn't needed), and is the version needed for immediate
testing of 6.2.1.


trying the map_obj.c test with 6.2.0 source code and vox50 example:
  http://grass.gdf-hannover.de/wiki/Help_with_3D#Examples

In nviz/script/nviz2.2_script line 18 I changed DEBUG to 1.


__ without patch: __

[G> nviz vol=vox50] it stalls on "Nv_mkPanelMenu 2 2  Vector Points"
NVIZ window all white with only "File" and "Help" menus, "Please
wait..." window is there too. windows are locked but % prompt in the
terminal is responsive.

[G> nviz -q, then Panel->Raster volumes]  it all works.
 (after puting lots of debug msgs in lib/ogsf/, now it breaks on [Add]?)


__ with map_obj.c patch: __

(and Soeren's "geovol_file *vf = NULL;" patch from the bug report)

[G> nviz vol=vox50] starts ok. 

But then it segfaults as soon as I try and add an isosurface.
Sometimes have to wait until second isosurface is added for the
segfault, other times it works.

with "nviz -q" I get the same segfault (sometimes).
switching between "nviz -q" and "nviz vol=vox50" makes it break pretty
reliably.


I can trace it here:

The READ defined at the top of gvld.c:
  #define READ() gvl_read_char(pos[i]++, gvl->isosurf[i]->data)
(there is also another slightly different READ in gvl_calc.c)

called by:
lib/ogsf/gvld.c   gvld_isosurf()
...
		    /* read cube index */
		    if (nz[i] != 0) {
			nz[i]--;
			continue;
		    }
		    else {
printf("in gvld_iso  i=%d pos=%d\n", i, pos[i]++);
printf("in gvld_iso  data=%x\n", gvl->isosurf[i]->data);
			c_ndx = READ();
...
from those printf's I get:
  in gvld_iso  i=0 pos=0
  in gvld_iso  data=0

and immediately in READ() [gvl_read_char()] I get

lib/ogsf/gvl_calc.c  gvl_read_char()
  pos=1073790160
  data=4000bcd0


?
Hamish
Thu, Nov 30 2006 07:39:09    Comments added by hbowman  
In the 6.2 release branch I added a warning if "vol=" was used suggesting a
work around. This way we can release 6.2.1 without a sure fix for this bug (ie
without making things worse; the fixes so far apparently exposes another bug
which makes 6.2's version fail for me when adding isosurfaces).


Hamish
Wed, Apr 4 2007 12:31:14    Comments added by hbowman  
fwd from the grass-dev mailing list:
------------------------------------------------------------


From: Markus Neteler
Subject: Re: [GRASS-dev] nviz volume fails: unknown shade style returned in
get_drawmode
Date: Tue, 3 Apr 2007 21:12:39 +0200
To: GRASS developers list

Hi all,

Bob was so kind to fix the NVIZ volume problem in CVS.
Please test it, too.

thanks, Bob!

Markus

On Tue, Apr 03, 2007 at 02:17:42PM -0300, Bob Covill wrote:
> Hi Markus,
> 
> I have submitted the fix to CVS. I have tested it by loading both from
> the command line and the GUI, and it seems to work. If you could also
> test to make sure this does not break anything else. 
> 
> --
> Bob
> 
> On Tue, 2007-04-03 at 17:36 +0200, Markus Neteler wrote:
> > Hi Bob,
> > 
> > On Tue, Apr 03, 2007 at 12:01:45PM -0300, Bob Covill wrote:
> > > Hi Markus,
> > > 
> > > This does seem to be a mystery. I tried "g.region -dp" and it still
> > > worked? 
> > 
> > I am on a 64bit box, may this be the difference? Or Redhat,
> > or the gcc version or...
> >  
> > > I then traced the error messages from below. I looked at how volumes are
> > > loaded from the command line it appears that none of the attributes are
> > > set (which is why it is complaining). When loaded from inside nviz there
> > > is a call to Nnew_map_obj (to load the file) and then set_att to set the
> > > attributes.  
> > > 
> > > I have attached a test version of map_obj.c from nviz/src for you to
> > > try. Essentially I set some default atts when a volume is loaded. So
> > > when you run 
> > > nviz el=dem500 vol=precip3d.500z50
> > > you should see
> > > Loading Data
> > > Update elev null mask
> > > Loading Data
> > > translating colors from fp
> > > VOL DEBUG: set vol atts for 81721
> > > VOL DEBUG: done setting vol pars
> > > recalculating normals...
> > > 
> > > If this still crashes then there is something else going on, but we can
> > > eliminate the above. If this does fix it then we should try and clean up
> > > how volumes are loaded.
> > > 
> > > I will keep my fingers crossed!
> > 
> > Great job!! It works!!
> > I don't manage to crash it any more... please submit it
> > to CVS.
> > 
> > thanks a million,
> > 
> > Markus

_______________________________________________
grass-dev mailing list
grass-dev ta grass.itc dot it
http://grass.itc.it/mailman/listinfo/grass-dev
Tue, Apr 24 2007 11:46:57    Mail sent by hbowman  
NVIZ volume problem is not fixed. :(
--latest 6.3 CVS--

G63> nviz vol=vox50
#loads ok  (see bug report for generating vox50)

# view height -> 75.0

Visualize -> Volumes
Isosurface [Add]

Segmentation fault

:-(


try again:
G63> nviz vol=vox50
#loads ok

Visualize -> Volumes
Isosurface [Add]
New Constant: 3000

# hey it took one!

Isosurface [Add]
New Constant: 
# here it doesn't let me enter anything in the text box

[Cancel]
New Constant: 2000   #now it gives me a cursor in the text box
[Ok]
invalid command name ".new_const.constant"
invalid command name ".new_const.constant"
    while executing
"$w.constant get"
    (procedure "create_constant_popup" line 27)
    invoked from within
"create_constant_popup .new_const 1"
    (procedure "aip_show_newconst" line 5)
    invoked from within
"aip_show_newconst threshold"
    invoked from within
".temporary_new_isosurf.f2.const invoke"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 [list $w invoke]"
    (procedure "tkButtonUp" line 7)
    invoked from within
"tkButtonUp .temporary_new_isosurf.f2.const
"
    (command bound to event)


# but it still adds the isosurface ok.

# same thing for adding more isosurfaces at 1000,500,...


6.2: the bug remains- NVIZ with vol= given on the command line locks up with
"Please wait..." window.


Hamish
Mon, May 28 2007 12:01:46    Comments added by hbowman  
Hi,

trying to track down the latest incarnation of the NVIZ Volume segfault.

# instructions how to make "vox50" in bug report #4725,
# prob any r3 map will do
G63> g.region rast3d=vox50
G63> nviz vol=vox50

(optional) Adjust height slider to 100.0. (type it in)

[Viz -> Volumes]
[Add] new isosurface
Segmentation fault

Happens about 70% of the time, if works once, it will continue to work
for that NVIZ session.

The segfault happens in nviz/scripts/attIsosurfPopup.tcl  line ~132.
    focus $w
    if {$mode} {grab $w}

    # tkspecial_wait window $w
->  tkwait window $w

    if {$DEBUG} {puts "Exiting from attIsoPopup"}


I assume that means it happens sometime when the $w window is open, not
in the tkwait call itself (tkwait just ends the main input loop).

gdb shows it happens in nviz/src/togl.c line 1947:
   /* don't share display lists */
   togl->GlCtx = glXCreateContext(dpy, visinfo, None, directCtx);

I notice that when the window does pop up, and you click custom value,
the cursor is not in the text entry box, and clicking on the text entry
box doesn't help. I need to set the focus to another window, then back
to the text entry window, then click in the box to get a cursor.

gdb session follows.

?,
Hamish


G63> gdb $GISBASE/etc/nviz2.2/nviz
(gdb) run -f $GISBASE/etc/nviz2.2/scripts/nviz2.2_script vol=vox50
Starting program:
/usr/local/src/grass/grass63/dist.i686-pc-linux-gnu/etc/nviz2.2/nviz -f
$GISBASE/etc/nviz2.2/scripts/nviz2.2_script vol=vox50
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 18519)]

Program received signal SIGFPE, Arithmetic exception.
[Switching to Thread 16384 (LWP 18519)]
0x419dbae0 in __driUtilCreateScreen () from /usr/X11R6/lib/modules/dri/r200_dri.so
#### Note this SEGFPE is at at startup, not when clicking "Add".
#### Empty grey NVIZ window (200x200) and black "Please wait..." windows are
open.

(gdb) bt
#0  0x419dbae0 in __driUtilCreateScreen () from
/usr/X11R6/lib/modules/dri/r200_dri.so
#1  0x419db67b in __driUtilCreateScreen () from
/usr/X11R6/lib/modules/dri/r200_dri.so
#2  0x419db7bf in __driUtilCreateScreen () from
/usr/X11R6/lib/modules/dri/r200_dri.so
#3  0x419492b2 in __driUtilCreateScreen () from
/usr/X11R6/lib/modules/dri/r200_dri.so
#4  0x419492d9 in __driUtilCreateScreen () from
/usr/X11R6/lib/modules/dri/r200_dri.so
#5  0x418c6c5a in __driUtilCreateScreen () from
/usr/X11R6/lib/modules/dri/r200_dri.so
#6  0x418c8d7c in __driUtilCreateScreen () from
/usr/X11R6/lib/modules/dri/r200_dri.so
#7  0x418c91e8 in __driUtilCreateScreen () from
/usr/X11R6/lib/modules/dri/r200_dri.so
#8  0x419e01bc in __driUtilCreateScreen () from
/usr/X11R6/lib/modules/dri/r200_dri.so
#9  0x418b235d in __driUtilUpdateDrawableInfo () from
/usr/X11R6/lib/modules/dri/r200_dri.so
#10 0x40828195 in _glthread_SetTSD () from /usr/X11R6/lib/libGL.so.1
#11 0x408282ec in glXCreateContext () from /usr/X11R6/lib/libGL.so.1
#12 0x08063e7b in Togl_CreateWindow (tkwin=0x8126008, parent=48234524,
instanceData=0x8126120)
    at togl.c:1947
#13 0x4063df88 in Tk_MakeWindowExist () from /usr/lib/libtk8.3.so.1
#14 0x080635ed in Togl_Cmd (clientData=0x808d9b8, interp=0x807a540, argc=8,
argv=0xbfffea20)
    at togl.c:1571
#15 0x406f97ab in TclInvokeStringCommand () from /usr/lib/libtcl8.3.so.1
#16 0x407140c8 in TclExecuteByteCode () from /usr/lib/libtcl8.3.so.1
#17 0x406fa07f in Tcl_EvalObjEx () from /usr/lib/libtcl8.3.so.1
#18 0x40737f4c in TclObjInterpProc () from /usr/lib/libtcl8.3.so.1
#19 0x4073129c in TclExpandTokenArray () from /usr/lib/libtcl8.3.so.1
#20 0x40731b3d in Tcl_EvalEx () from /usr/lib/libtcl8.3.so.1
#21 0x40728a0e in Tcl_EvalFile () from /usr/lib/libtcl8.3.so.1
#22 0x40632774 in Tk_MainEx () from /usr/lib/libtk8.3.so.1
#23 0x080622e0 in main (argc=4, argv=0xbffff624) at nvizMain.c:62


(gdb) bt full
[...]
#12 0x08063e7b in Togl_CreateWindow (tkwin=0x8126008, parent=48234524,
instanceData=0x8126120)
    at togl.c:1947
        attempt = 0
        togl = (Togl *) 0x8126120
        visinfo = (XVisualInfo *) 0x8127d40
        dpy = (Display *) 0x8086a48
        cmap = 0
        scrnum = 1073835168
        window = 1075391240
        directCtx = 1
        attrib_list = {1, 4, 8, 1, 9, 1, 10, 1, 12, 1, 5, 0 <repeats 353
times>, 1084246465, 
  0, 0, 1093267355, 0, 1085040226, 1085042247, -1073748628, 1084157883,
-1073748600, 
  1085040226, 6, 0, 0, 0, 0, 0, -1073748648, 1084150807, 0 <repeats 47 times>,
544407552, 0, 
  4, -4, 0 <repeats 14 times>, -1073749720, 0, 2, -1073748388, -1073748648, 0,
1085040217, 
  15, -1, 0 <repeats 22 times>, 1085040225, 1085040232, 0 <repeats 38 times>,
1084246465, 0, 
  0, 0, 0, 1081434067, -1073748030, -1073748008, 1084157883, -1073747980,
1081434067, 0, 0, 
  0, 0, 0, 0, -1073748028, 1084150807, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1084246465,
0, 0, 0, 0, 
  1081434067, -1073747917, -1073747896, 1084157883, -1073747868, 1081434067,
0, 0, 0, 0, 0, 
  0, -1073747916, 1084150807, 0 <repeats 19 times>, 543424512, 0 <repeats 12
times>, 10, 10, 
  135417804, 0, 0, -1073749100, 0, 1, -1073747768, -1073748028, 0, 1081434065,
6, -1, 0, 
  543424512, 0 <repeats 12 times>, 10, 8, 135397492, 0, 0, -1073748988, 0, 1,
-1073747656, 
  1081434067, 0...}
        attrib_count = 12
        dummy = 77
        swa = {background_pixmap = 0, background_pixel = 0, border_pixmap = 0,
border_pixel = 0, bit_gravity = 0, win_gravity = 0, backing_store = 0,
backing_planes = 0, 
  backing_pixel = 0, save_under = 0, event_mask = 0, do_not_propagate_mask =
0, 
  override_redirect = 0, colormap = 0, cursor = 0}
        ci_depths = {8, 4, 2, 1, 12, 16, 8, 4, 2, 1, 12, 16}
        dbl_flags = {0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1}
#13 0x4063df88 in Tk_MakeWindowExist () from /usr/lib/libtk8.3.so.1
No symbol table info available.
#14 0x080635ed in Togl_Cmd (clientData=0x808d9b8, interp=0x807a540, argc=8,
argv=0xbfffea20)
    at togl.c:1571
        name = 0x811ead0 ".middle.draw.canvas"
        mainwin = 0x808d9b8
        tkwin = 0x8126008
        togl = (Togl *) 0x8126120
[...]

#### not the same gdb session:
(gdb) frame 12
#12 0x08063e87 in Togl_CreateWindow (tkwin=0x8125f50, parent=48234524,
instanceData=0x8126068)
    at togl.c:1947
1947                    togl->GlCtx = glXCreateContext(dpy, visinfo, None,
directCtx);


(gdb) list
1942                        shareCtx = None;
1943                    togl->GlCtx =
1944                            glXCreateContext(dpy, visinfo, shareCtx,
directCtx);
1945                } else {
1946                    /* don't share display lists */
1947                    togl->GlCtx = glXCreateContext(dpy, visinfo, None,
directCtx);
1948                }
1949    
1950                if (togl->GlCtx == NULL) {
1951                    Tcl_SetResult(togl->Interp,



I notice during make:

togl.c: In function `Togl_Configure':
togl.c:1240: warning: passing arg 5 of `Tk_ConfigureWidget' from incompatible
pointer type
togl.c: In function `Togl_Widget':
togl.c:1339: warning: passing arg 4 of `Togl_Configure' from incompatible
pointer type
togl.c: In function `Togl_Cmd':
togl.c:1431: warning: passing arg 3 of `Tk_CreateWindowFromPath' discards
qualifiers from pointer target type
togl.c:1551: warning: passing arg 4 of `Togl_Configure' from incompatible
pointer type
Mon, May 28 2007 12:11:15    Comments added by hbowman  
vox50 3d raster is here:
  http://grass.gdf-hannover.de/wiki/Help_with_3D#Examples


But more tests show that this happens in the same place on startup even
with the no-opt "-q" quick flag.

G63> gdb $GISBASE/etc/nviz2.2/nviz
(gdb) run -f $GISBASE/etc/nviz2.2/scripts/nviz2.2_script -q
Starting program:
/usr/local/src/grass/grass63/dist.i686-pc-linux-gnu/etc/nviz2.2/nviz -f
$GISBASE/etc/nviz2.2/scripts/nviz2.2_script -q
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 18821)]

Program received signal SIGFPE, Arithmetic exception.
[Switching to Thread 16384 (LWP 18821)]

(gdb) frame 12
#12 0x08063e7b in Togl_CreateWindow (tkwin=0x8121690, parent=44040220,
instanceData=0x81217a8)
    at togl.c:1947
1947                    togl->GlCtx = glXCreateContext(dpy, visinfo, None,
directCtx);


So not volume= specific!


Hamish
Comment | Reply | Take | Resolve

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