Opened 12 years ago

Closed 12 years ago

#36 closed defect (fixed)

v.generalize Assertion failed.

Reported by: marisn Owned by: grass-dev@…
Priority: major Milestone: 6.4.0
Component: Default Version: svn-trunk
Keywords: Cc:
CPU: Unspecified Platform: Unspecified

Description

(gdb) run -r input=cont_4144@PERMANENT output=cont_4144_general type=line method=hermite threshold=3 look_ahead=7 reduction=50 slide=0.5 angle_thresh=3 degree_thresh=0 closeness_thresh=0 betweeness_thresh=0 alpha=1.0 beta=1.0 iterations=1 layer=1 --overwrite
Starting program: /home/maris/soft/grass_trunk/dist.x86_64-unknown-linux-gnu/bin/v.generalize -r input=cont_4144@PERMANENT output=cont_4144_general type=line method=hermite threshold=3 look_ahead=7 reduction=50 slide=0.5 angle_thresh=3 degree_thresh=0 closeness_thresh=0 betweeness_thresh=0 alpha=1.0 beta=1.0 iterations=1 layer=1 --overwrite
[Thread debugging using libthread_db enabled]
[New Thread 0x2b33d27a2ce0 (LWP 16093)]
WARNING: Vector map <cont_4144_general> already exists and will be
         overwritten
Generalization (hermite)...
 100%
Building topology for vector map <cont_4144_general>...
Registering lines: v.generalize: index.c:157: RTreeInsertRect: Assertion `r->boundary[i] <= r->boundary[3+i]' failed.

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x2b33d27a2ce0 (LWP 16093)]
0x00002b33cf082b45 in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x00002b33cf082b45 in raise () from /lib64/libc.so.6
#1  0x00002b33cf0840e0 in abort () from /lib64/libc.so.6
#2  0x00002b33cf07c07f in __assert_fail () from /lib64/libc.so.6
#3  0x00002b33ce27df3e in RTreeInsertRect (R=<value optimized out>, Tid=<value optimized out>, Root=0x7fffddb5fa50, Level=0)
    at index.c:157
#4  0x00002b33ce075559 in dig_spidx_add_line (Plus=0x7fffddb5f840, line=12, box=0x7fffddb5f5b0) at spindex.c:128
#5  0x00002b33ce071561 in dig_add_line (plus=0x7fffddb5f840, type=2, Points=0x74ad50, offset=105753) at plus_line.c:133
#6  0x00002b33cd177cab in Vect_build_nat (Map=0x7fffddb5f830, build=4, msgout=0x2b33cf391760) at build_nat.c:501
#7  0x00002b33cd1767a3 in Vect_build_partial (Map=0x7fffddb5f830, build=4, msgout=0x2b33cf391760) at build.c:152
#8  0x0000000000404e23 in main (argc=19, argv=0xfffffffe) at main.c:489 

OS: OpenSuSE 10.3 64bit GRASS: svn-trunk rev. 29954

Change History (7)

comment:1 Changed 12 years ago by wolf

The assert happens inside Vlib (the vector library). Could you please test v.build on a similar map, to see if it happens there too. Also can you provide a sample map where this problem occurs.

Thank you, --Wolf

comment:2 Changed 12 years ago by marisn

  1. Other vector modules run just fine (v.buid), also v.generalize runs just fine with other methods (i.e. method=douglas) => IMHO it's a problem within v.generalize;
  2. Location with "guity" map: http://www.gisnet.lv/ggmlinux/tomazio_modeli.tgz (2,6M)

comment:3 in reply to:  description ; Changed 12 years ago by martinl

Replying to marisn:

> (gdb) run -r input=cont_4144@PERMANENT output=cont_4144_general type=line method=hermite threshold=3 look_ahead=7 reduction=50 slide=0.5 angle_thresh=3 degree_thresh=0 closeness_thresh=0 betweeness_thresh=0 alpha=1.0 beta=1.0 iterations=1 layer=1 --overwrite
> Starting program: /home/maris/soft/grass_trunk/dist.x86_64-unknown-linux-gnu/bin/v.generalize -r input=cont_4144@PERMANENT output=cont_4144_general type=line method=hermite threshold=3 look_ahead=7 reduction=50 slide=0.5 angle_thresh=3 degree_thresh=0 closeness_thresh=0 betweeness_thresh=0 alpha=1.0 beta=1.0 iterations=1 layer=1 --overwrite
> [Thread debugging using libthread_db enabled]
> [New Thread 0x2b33d27a2ce0 (LWP 16093)]
> WARNING: Vector map <cont_4144_general> already exists and will be
>          overwritten
> Generalization (hermite)...
>  100%
> Building topology for vector map <cont_4144_general>...
> Registering lines: v.generalize: index.c:157: RTreeInsertRect: Assertion `r->boundary[i] <= r->boundary[3+i]' failed.
> 
> Program received signal SIGABRT, Aborted.
> [Switching to Thread 0x2b33d27a2ce0 (LWP 16093)]
> 0x00002b33cf082b45 in raise () from /lib64/libc.so.6
> (gdb) bt
> #0  0x00002b33cf082b45 in raise () from /lib64/libc.so.6
> #1  0x00002b33cf0840e0 in abort () from /lib64/libc.so.6
> #2  0x00002b33cf07c07f in __assert_fail () from /lib64/libc.so.6
> #3  0x00002b33ce27df3e in RTreeInsertRect (R=<value optimized out>, Tid=<value optimized out>, Root=0x7fffddb5fa50, Level=0)
>     at index.c:157
> #4  0x00002b33ce075559 in dig_spidx_add_line (Plus=0x7fffddb5f840, line=12, box=0x7fffddb5f5b0) at spindex.c:128
> #5  0x00002b33ce071561 in dig_add_line (plus=0x7fffddb5f840, type=2, Points=0x74ad50, offset=105753) at plus_line.c:133
> #6  0x00002b33cd177cab in Vect_build_nat (Map=0x7fffddb5f830, build=4, msgout=0x2b33cf391760) at build_nat.c:501
> #7  0x00002b33cd1767a3 in Vect_build_partial (Map=0x7fffddb5f830, build=4, msgout=0x2b33cf391760) at build.c:152
> #8  0x0000000000404e23 in main (argc=19, argv=0xfffffffe) at main.c:489 

From ML by Daniel Bundala:

I just checked it and it works fine for me. I tried it with the map and command you sent and everything was ok. What version of GRASS do you use? As I remember, there were a few problems with hermite interpolation some time ago, but it should be fixed now. The problem occured when a line in the map contained two consecutive points at the same position. If this is the case then you can remove such points with v.generalize itself (method=reduction threshold=eps) or with v.clean

Daniel

---

On my machine (Debian GNU/Linux, 32bit, grass-svn) I get the same error

Registering lines: v.generalize: index.c:157: RTreeInsertRect: Assertion `r->boundary[i] <= r->boundary[3+i]' failed.

Martin

comment:4 in reply to:  3 Changed 12 years ago by martinl

On my machine (Debian GNU/Linux, 32bit, grass-svn) I get the same error

> Registering lines: v.generalize: index.c:157: RTreeInsertRect: Assertion `r->boundary[i] <= r->boundary[3+i]' failed.

sorry, I forgot to add debug output

D3/5: Register node 391690.000000,392030.000000
D3/5: dig_find_node()
D3/5: node = 0
D3/5: dig_add_node(): n_nodes = 11, alloc_nodes = 1000
D3/5: dig_spidx_add_node(): node = 12, x,y,z = 391690.000000, 392030.000000, 0.000000
D3/5: new node = 12, n_nodes = 12, alloc_nodes = 1000
D3/5: Add new node: 12
D3/5: dig_node_add_line(): node = 12 line = -12
D3/5: dig_node_alloc_line(): add = 1
D5/5: dig_line_degenerate()
D3/5:     angle = nan
D3/5: dig_node_add_line(): line -12 added position 1 n_lines: 1 angle nan
D3/5: dig_spidx_add_line(): line = 12
v.generalize: index.c:157: RTreeInsertRect: Assertion `r->boundary[i] <= r->boundary[3+i]' failed.
Aborted

comment:5 Changed 12 years ago by hamish

Daniel Bundala wrote on grass-dev:

Hello,

Finally, I had some time to look at it carefully. It seems to me that the problem is the same as the one I mentioned earlier. I made a patch some time ago, but for some obscure reasons, it did not propagate to the SVN. I think that the patch should fix it as it is the only difference between the version in SVN and on my computer.

Daniel

PS: I am not a big expert on CVS/SVN so the patch may be little out of date.....

The patch applied fine, now in SVN/trunk (r30050) and 6.3 release branch (r30051). It still needs testing.

Should it use GRASS_EPSILON from include/gis.h instead of hardcoded 1e-12 ?

just do:

$ svn up vector/v.generalize
# make changes
$ vi vector/v.generalize/smoothing.c
# check it
$ svn diff vector/v.generalize
$ svn diff vector/v.generalize > v.gen_fix.diff

"svn up" after changes should try and merge in any new updates which don't directly conflict.

Hamish

comment:6 Changed 12 years ago by neteler

Done:

http://trac.osgeo.org/grass/changeset/30055

I also fixed that no exit() needed after G_fatal_error(). The second constant I didn't find, though. Please tell us the line number: http://trac.osgeo.org/grass/browser/grass/trunk/vector/v.generalize/smoothing.c

Markus

comment:7 Changed 12 years ago by marisn

Resolution: fixed
Status: newclosed

Seems to be fixed now. No crash here anymore :)

Note: See TracTickets for help on using tickets.