[GRASS-dev] [GRASS GIS] #1933: v.overlay ends with sigsegv in cut lines by polygon

#1933: v.overlay ends with sigsegv in cut lines by polygon
-----------------------+----------------------------------------------------
Reporter: mapycz | Owner: grass-dev@…
     Type: defect | Status: new
Priority: blocker | Milestone: 7.0.0
Component: Vector | Version: unspecified
Keywords: v.overlay | Platform: Unspecified
      Cpu: x86-64 |
-----------------------+----------------------------------------------------
we tried cut contours by polygon but v.overaly crashed

our training dta consist of contour lines and polygon
these data is in tar.bz2 archive in this location:
http://work.talasek.sk:2222/download/grass_error.tar.bz2

here is some debug

GRASS 7.0.svn (test1):~/grassgis/grass-svn > gdb v.overlay
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html&gt;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/&gt;\.\.\.
Reading symbols from /usr/local/grass-7.0.svn/bin/v.overlay...done.
(gdb) run ainput=cnt_sm atype=line binput=cut_poly operator=and
output=cnt_cut1 --overwrite
Starting program: /usr/local/grass-7.0.svn/bin/v.overlay ainput=cnt_sm
atype=line binput=cut_poly operator=and output=cnt_cut1 --overwrite
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
WARNING: Vector map <cnt_cut1> already exists and will be overwritten
WARNING: Table <cnt_cut1> linked to vector map <cnt_cut1> does not exist
Copying vector features from <cnt_sm@miro>...
  100%
Copying vector features from <cut_poly@miro>...
  100%
Breaking lines...
    0%
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b7e55b in break_lines (Map=0x7fffffffc040, List_break=0x0,
List_ref=0x61f8d0, type=6, Err=0x0, check=0) at break_lines.c:360
360 !touch1_w && nodex == BBox->E) ||
(gdb) info local
APoints = 0x1276530
BPoints = 0x1276560
Points = 0x1276590
AXLines = 0x7ffff753328c
BXLines = 0x7fffffffa9b0
ACats = 0x12765c0
BCats = 0x12765e0
Cats = 0x1276600
i = 0
j = -1
k = 32767
l = -20688
ret = -138628762
atype = 4
btype = 4
aline = 17849
bline = 17849
found = 0
iline = 0
nlines = 13
nlines_org = 17861
naxlines = 32767
nbxlines = -7760
nx = 32767
xx = 0x0
yx = 0x0
zx = 0x0
ABox = {N = 5557464.4957634434, S = 5506178.6524737561, E =
790483.12121040502, W = 725733.38919512555, T = 0, B = 0}
BBox = 0x7fffe7415fe0
List = 0x1276620
nbreaks = 0
touch1_n = 1
touch1_s = 1
touch1_e = 1
touch1_w = 0
touch2_n = 1
touch2_s = 1
touch2_e = 1
touch2_w = 1
is3d = 0
node = 17862
anode1 = 17862
anode2 = 17863
bnode1 = 17862
bnode2 = 17863
nodex = 725733.38919512555
nodey = 5556926.5740271173
a_is_ref = 1
b_is_ref = 1
break_a = 1
break_b = 0
(gdb)

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1933&gt;
GRASS GIS <http://grass.osgeo.org>

#1933: v.overlay ends with sigsegv in cut lines by polygon
--------------------------+-------------------------------------------------
  Reporter: mapycz | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: blocker | Milestone: 7.0.0
Component: Vector | Version: unspecified
Resolution: invalid | Keywords: v.overlay
  Platform: Unspecified | Cpu: x86-64
--------------------------+-------------------------------------------------
Changes (by mapycz):

  * status: new => closed
  * resolution: => invalid

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1933#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1933: v.overlay ends with sigsegv in cut lines by polygon
--------------------------+-------------------------------------------------
  Reporter: mapycz | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: blocker | Milestone: 7.0.0
Component: Vector | Version: unspecified
Resolution: | Keywords: v.overlay
  Platform: Unspecified | Cpu: x86-64
--------------------------+-------------------------------------------------
Changes (by mapycz):

  * status: closed => reopened
  * resolution: invalid =>

Comment:

hmm big fixed but ....
can u see for result ? some lines disappear and result is nod good,
computataion is abnormally fast

i feel it is something similar #55854

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1933#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1933: v.overlay ends with sigsegv in cut lines by polygon
--------------------------+-------------------------------------------------
  Reporter: mapycz | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: blocker | Milestone: 7.0.0
Component: Vector | Version: unspecified
Resolution: | Keywords: v.overlay
  Platform: Unspecified | Cpu: x86-64
--------------------------+-------------------------------------------------

Comment(by mapycz):

sry similar ticket is #1875

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1933#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1933: v.overlay ends with sigsegv in cut lines by polygon
----------------------+-----------------------------------------------------
  Reporter: mapycz | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: blocker | Milestone: 7.0.0
Component: Vector | Version: svn-trunk
Resolution: | Keywords: v.overlay
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------
Changes (by mapycz):

  * platform: Unspecified => Linux
  * version: unspecified => svn-trunk

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1933#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#1933: v.overlay ends with sigsegv in cut lines by polygon
----------------------+-----------------------------------------------------
  Reporter: mapycz | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: blocker | Milestone: 7.0.0
Component: Vector | Version: svn-trunk
Resolution: | Keywords: v.overlay
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------

Comment(by mmetz):

Replying to [comment:2 mapycz]:
> hmm big fixed but ....
> can u see for result ? some lines disappear and result is nod good

I checked with r55797, no disappearing lines, result seems good. Can you
provide a screenshot and coordinates where lines disappear?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1933#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#1933: v.overlay ends with sigsegv in cut lines by polygon
----------------------+-----------------------------------------------------
  Reporter: mapycz | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: blocker | Milestone: 7.0.0
Component: Vector | Version: svn-trunk
Resolution: | Keywords: v.overlay
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------

Comment(by mapycz):

u can try my dataset
http://work.talasek.sk:2222/download/grass_error.tar.bz2
in my machine result of cut is totally unusable i attach two screenshots
before cut and after cut (i want cut contours by blue polygon)

v.overlay ainput=cnt_sm atype=line binput=cut_poly operator=and
output=cnt_cut1 --overwrite

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1933#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>

#1933: v.overlay ends with sigsegv in cut lines by polygon
----------------------+-----------------------------------------------------
  Reporter: mapycz | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: blocker | Milestone: 7.0.0
Component: Vector | Version: svn-trunk
Resolution: | Keywords: v.overlay
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------

Comment(by mmetz):

Replying to [comment:6 mapycz]:
> u can try my dataset
http://work.talasek.sk:2222/download/grass_error.tar.bz2
> in my machine result of cut is totally unusable i attach two screenshots
before cut and after cut (i want cut contours by blue polygon)

I can not reproduce, see attachment for the correct cut with GRASS 7
r55858. Please make sure that you have updated vector libs and v.overlay.

>
> v.overlay ainput=cnt_sm atype=line binput=cut_poly operator=and
output=cnt_cut1 --overwrite

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1933#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>

#1933: v.overlay ends with sigsegv in cut lines by polygon
----------------------+-----------------------------------------------------
  Reporter: mapycz | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: blocker | Milestone: 7.0.0
Component: Vector | Version: svn-trunk
Resolution: | Keywords: v.overlay
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------

Comment(by mapycz):

machine
{{{
Linux eva 3.2.0-2-amd64 #1 SMP Tue Mar 20 18:36:37 UTC 2012 x86_64
GNU/Linux

GCC: gcc version 4.6.3 (Debian 4.6.3-1)
CPU: 12x Intel(R) Xeon(R) CPU E5645 @ 2.40GHz
RAM: 64GB
}}}
we have latest source
{{{ grassgis/grass-svn$ svn info
Path: .
URL: https://svn.osgeo.org/grass/grass/trunk
Repository Root: https://svn.osgeo.org/grass
Repository UUID: 15284696-431f-4ddb-bdfa-cd5b030d7da7
Revision: 55884
Node Kind: directory
Schedule: normal
Last Changed Author: wenzeslaus
Last Changed Rev: 55884
Last Changed Date: 2013-04-18 11:45:54 +0200 (Thu, 18 Apr 2013)
}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1933#comment:8&gt;
GRASS GIS <http://grass.osgeo.org>

#1933: v.overlay ends with sigsegv in cut lines by polygon
----------------------+-----------------------------------------------------
  Reporter: mapycz | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: blocker | Milestone: 7.0.0
Component: Vector | Version: svn-trunk
Resolution: | Keywords: v.overlay
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------

Comment(by mapycz):

sorry
{{{
svn info
Path: .
URL: https://svn.osgeo.org/grass/grass/trunk
Repository Root: https://svn.osgeo.org/grass
Repository UUID: 15284696-431f-4ddb-bdfa-cd5b030d7da7
Revision: 55884
Node Kind: directory
Schedule: normal
Last Changed Author: wenzeslaus
Last Changed Rev: 55884
Last Changed Date: 2013-04-18 11:45:54 +0200 (Thu, 18 Apr 2013)
}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1933#comment:9&gt;
GRASS GIS <http://grass.osgeo.org>

#1933: v.overlay ends with sigsegv in cut lines by polygon
----------------------+-----------------------------------------------------
  Reporter: mapycz | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: blocker | Milestone: 7.0.0
Component: Vector | Version: svn-trunk
Resolution: | Keywords: v.overlay
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------

Comment(by mapycz):

and question is how long time consumpting your computation
our is abnormally fast , if we use grass 6.4 then result was good and
computation time was more tmes more than 7.0

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1933#comment:10&gt;
GRASS GIS <http://grass.osgeo.org>

#1933: v.overlay ends with sigsegv in cut lines by polygon
----------------------+-----------------------------------------------------
  Reporter: mapycz | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: blocker | Milestone: 7.0.0
Component: Vector | Version: svn-trunk
Resolution: | Keywords: v.overlay
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------

Comment(by mmetz):

Replying to [comment:10 mapycz]:
> and question is how long time consumpting your computation
> our is abnormally fast , if we use grass 6.4 then result was good and
computation time was more tmes more than 7.0

50 sec on 6.4, 4 sec on 7.0. The results are identical. The machine is a
laptop with linux and Intel(R) Core(TM) i5 CPU M 450 @ 2.40GHz.

Do you have local changes in v.overlay? No local changes on my side. Does
recompiling (make distclean, configure, make) help?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1933#comment:11&gt;
GRASS GIS <http://grass.osgeo.org>

#1933: v.overlay ends with sigsegv in cut lines by polygon
----------------------+-----------------------------------------------------
  Reporter: mapycz | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: blocker | Milestone: 7.0.0
Component: Vector | Version: svn-trunk
Resolution: | Keywords: v.overlay
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------

Comment(by mapycz):

we discover that problem appear only if we generate contours from dem ,
than smooth it and than v.overlay .
Everything work if smoothed contour was saved to shapefile and then read
from it and then clipping

now we build our start dataset and our action sequence to reproduce this
bug

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1933#comment:12&gt;
GRASS GIS <http://grass.osgeo.org>

#1933: v.overlay ends with sigsegv in cut lines by polygon
----------------------+-----------------------------------------------------
  Reporter: mapycz | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: blocker | Milestone: 7.0.0
Component: Vector | Version: svn-trunk
Resolution: | Keywords: v.overlay
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------

Comment(by mmetz):

Replying to [comment:12 mapycz]:
> we discover that problem appear only if we generate contours from dem ,
than smooth it and than v.overlay .

OK. The contours are 3D, the polygon is 2D, that causes problems for the
clipping.

> Everything work if smoothed contour was saved to shapefile and then read
from it and then clipping

You can also transform contour z values to zero with v.transform zscale=0,
then v.overlay.

You could create a new ticket for the 3D lines clipping problem.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1933#comment:13&gt;
GRASS GIS <http://grass.osgeo.org>

#1933: v.overlay ends with sigsegv in cut lines by polygon
----------------------+-----------------------------------------------------
  Reporter: mapycz | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: blocker | Milestone: 7.0.0
Component: Vector | Version: svn-trunk
Resolution: | Keywords: v.overlay
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------

Comment(by mapycz):

can u try reproduce error ? if yes i will create ticket
our input dataset
http://work.talasek.sk:2222/download/grass_error1.tar.bz2

our commands
{{{
v.in.ogr ./polygon.shp output=cut_poly --overwrite
r.in.gdal ./terrain.tif output=dem --overwrite

g.region rast=dem.1

r.contour dem.1 output=cnt cut=200 step=10 --overwrite
v.generalize cnt output=cnt_sm method=sliding_averaging look_ahead=7
slide=1 threshold=1 --overwrite
v.overlay ainput=cnt_sm atype=line binput=cut_poly operator=and
output=cnt_cut1 --overwrite
}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1933#comment:14&gt;
GRASS GIS <http://grass.osgeo.org>

#1933: v.overlay ends with sigsegv in cut lines by polygon
----------------------+-----------------------------------------------------
  Reporter: mapycz | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: blocker | Milestone: 7.0.0
Component: Vector | Version: svn-trunk
Resolution: | Keywords: v.overlay
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------

Comment(by mmetz):

Replying to [comment:14 mapycz]:
> can u try reproduce error ?

Yes, fixed with r55907. It's only a small change to v.overlay.

Note that the output of v.overlay is always 2D (has always been so). The
contour levels in the "level" column are preserved if you add the option
olayer=0,1,0 to v.overlay.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1933#comment:15&gt;
GRASS GIS <http://grass.osgeo.org>

#1933: v.overlay ends with sigsegv in cut lines by polygon
----------------------+-----------------------------------------------------
  Reporter: mapycz | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: blocker | Milestone: 7.0.0
Component: Vector | Version: svn-trunk
Resolution: fixed | Keywords: v.overlay
  Platform: Linux | Cpu: x86-64
----------------------+-----------------------------------------------------
Changes (by mapycz):

  * status: reopened => closed
  * resolution: => fixed

Comment:

yes thanks , it works well now

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1933#comment:16&gt;
GRASS GIS <http://grass.osgeo.org>