[GRASS-dev] Re: [GRASS GIS] #801: r.le.patch crashes with -c flag
GRASS GIS
trac at osgeo.org
Wed Nov 4 14:40:05 EST 2009
#801: r.le.patch crashes with -c flag
-------------------------+--------------------------------------------------
Reporter: wilsonadam | Owner: grass-dev at lists.osgeo.org
Type: defect | Status: new
Priority: normal | Milestone: 6.4.0
Component: default | Version: 6.4.0 RCs
Resolution: | Keywords: segmentation fault
Platform: Linux | Cpu: x86-64
-------------------------+--------------------------------------------------
Old description:
> I am trying to run r.le.patch to create a map of separate 'patches' using
> the -c flag to drop the edges and only keep core areas of a certain size.
>
> To recreate this:
>
> {{{
>
> g.region n=1 s=0 e=1 w=0 res=.01 ## Make some region
> r.random.surface output=surface ## create a raster to use as input
> r.random input=surface n=10 raster_output=points ## create some random
> points
> r.grow input=points radius=10 output=patch ## grow them to make 'patches'
> r.le.patch -n map=patch sam=w co1=2 co2=c1 ## run r.le.patch with -n flag
> to identify the patches by number - it works fine
> r.le.patch -c map=patch sam=w co1=2 co2=c1 ## run r.le.patch with -c flag
> to identify only 'core areas' - it crashes!
> }}}
>
> It segfaults with the error shown below. I am running the GRASS6.4.0RC5
> checked out and compiled this morning on Fedora 11
> 2.6.30.9-90.fc11.x86_64
>
> Any ideas? Am I doing something wrong or is this a bug? I've tried
> several settings for the co1 and c02 and it crashes with every
> combination I have tried.
>
> Thanks for any help.
>
> ###########################################################
>
> {{{
> GRASS 6.4.0RC5 (CFR):/media/Data > r.le.patch -c map=patch sam=w co1=2
> co2=c1
>
> PARAMETER CHOICES:
> MAP: patch
> SAMPLE: whole map TRACING: 8 neighbor
> OUTPUT MAPS:
> interior
> CORE MEASURES:
> mean core size
>
> R.LE.PATCH IS WORKING....;
>
> *** glibc detected *** r.le.patch: double free or corruption (out):
> 0x0000000001c92be0 ***
> ======= Backtrace: =========
> /lib64/libc.so.6[0x39e5e75a96]
> r.le.patch(cell_clip+0x8fa)[0x417cea]
> r.le.patch(cell_clip_drv+0x18c)[0x4180dc]
> r.le.patch(patch_fore+0x98)[0x40c2d8]
> r.le.patch(main+0x4fe)[0x40e61e]
> /lib64/libc.so.6(__libc_start_main+0xfd)[0x39e5e1ea2d]
> r.le.patch[0x403109]
> ======= Memory map: ========
> 00400000-0041d000 r-xp 00000000 fd:00 341102
> /usr/local/grass-6.4.0RC5/bin/r.le.patch
> 0061d000-0061e000 rw-p 0001d000 fd:00 341102
> /usr/local/grass-6.4.0RC5/bin/r.le.patch
> 01c4c000-01caf000 rw-p 00000000 00:00 0
> [heap]
> 39e5a00000-39e5a1f000 r-xp 00000000 fd:00 45132
> /lib64/ld-2.10.1.so
> 39e5c1e000-39e5c1f000 r--p 0001e000 fd:00 45132
> /lib64/ld-2.10.1.so
> 39e5c1f000-39e5c20000 rw-p 0001f000 fd:00 45132
> /lib64/ld-2.10.1.so
> 39e5e00000-39e5f64000 r-xp 00000000 fd:00 45133
> /lib64/libc-2.10.1.so
> 39e5f64000-39e6164000 ---p 00164000 fd:00 45133
> /lib64/libc-2.10.1.so
> 39e6164000-39e6168000 r--p 00164000 fd:00 45133
> /lib64/libc-2.10.1.so
> 39e6168000-39e6169000 rw-p 00168000 fd:00 45133
> /lib64/libc-2.10.1.so
> 39e6169000-39e616e000 rw-p 00000000 00:00 0
> 39e6200000-39e6282000 r-xp 00000000 fd:00 54274
> /lib64/libm-2.10.1.so
> 39e6282000-39e6482000 ---p 00082000 fd:00 54274
> /lib64/libm-2.10.1.so
> 39e6482000-39e6483000 r--p 00082000 fd:00 54274
> /lib64/libm-2.10.1.so
> 39e6483000-39e6484000 rw-p 00083000 fd:00 54274
> /lib64/libm-2.10.1.so
> 39e6600000-39e6602000 r-xp 00000000 fd:00 56013
> /lib64/libdl-2.10.1.so
> 39e6602000-39e6802000 ---p 00002000 fd:00 56013
> /lib64/libdl-2.10.1.so
> 39e6802000-39e6803000 r--p 00002000 fd:00 56013
> /lib64/libdl-2.10.1.so
> 39e6803000-39e6804000 rw-p 00003000 fd:00 56013
> /lib64/libdl-2.10.1.so
> 39e6a00000-39e6a15000 r-xp 00000000 fd:00 56006
> /lib64/libz.so.1.2.3
> 39e6a15000-39e6c14000 ---p 00015000 fd:00 56006
> /lib64/libz.so.1.2.3
> 39e6c14000-39e6c15000 rw-p 00014000 fd:00 56006
> /lib64/libz.so.1.2.3
> 39f0400000-39f0419000 r-xp 00000000 fd:00 116332
> /lib64/libgcc_s-4.4.1-20090729.so.1
> 39f0419000-39f0619000 ---p 00019000 fd:00 116332
> /lib64/libgcc_s-4.4.1-20090729.so.1
> 39f0619000-39f061a000 rw-p 00019000 fd:00 116332
> /lib64/libgcc_s-4.4.1-20090729.so.1
> 7f308a2da000-7f308f3ad000 r--p 00000000 fd:00 56067
> /usr/lib/locale/locale-archive
> 7f308f3ad000-7f308f3b0000 rw-p 00000000 00:00 0
> 7f308f3d2000-7f308f3da000 r-xp 00000000 fd:00 358068
> /usr/local/grass-6.4.0RC5/lib/libgrass_datetime.6.4.0RC5.so
> 7f308f3da000-7f308f5d9000 ---p 00008000 fd:00 358068
> /usr/local/grass-6.4.0RC5/lib/libgrass_datetime.6.4.0RC5.so
> 7f308f5d9000-7f308f5da000 rw-p 00007000 fd:00 358068
> /usr/local/grass-6.4.0RC5/lib/libgrass_datetime.6.4.0RC5.so
> 7f308f5da000-7f308f5db000 rw-p 00000000 00:00 0
> 7f308f5db000-7f308f62c000 r-xp 00000000 fd:00 358108
> /usr/local/grass-6.4.0RC5/lib/libgrass_gis.6.4.0RC5.so
> 7f308f62c000-7f308f82c000 ---p 00051000 fd:00 358108
> /usr/local/grass-6.4.0RC5/lib/libgrass_gis.6.4.0RC5.so
> 7f308f82c000-7f308f82e000 rw-p 00051000 fd:00 358108
> /usr/local/grass-6.4.0RC5/lib/libgrass_gis.6.4.0RC5.so
> 7f308f82e000-7f308f838000 rw-p 00000000 00:00 0
> 7fffcf185000-7fffcf19a000 rw-p 00000000 00:00 0
> [stack]
> 7fffcf1ee000-7fffcf1ef000 r-xp 0000000Aborted
> }}}
New description:
I am trying to run r.le.patch to create a map of separate 'patches' using
the -c flag to drop the edges and only keep core areas of a certain size.
To recreate this:
{{{
g.region n=1 s=0 e=1 w=0 res=.01 ## Make some region
r.random.surface output=surface ## create a raster to use as input
r.random input=surface n=10 raster_output=points ## create some random
points
r.grow input=points radius=10 output=patch ## grow them to make 'patches'
r.le.patch -n map=patch sam=w co1=2 co2=c1 ## run r.le.patch with -n flag
to identify the patches by number - it works fine
r.le.patch -c map=patch sam=w co1=2 co2=c1 ## run r.le.patch with -c flag
to identify only 'core areas' - it crashes!
}}}
It segfaults with the error shown below. I am running the GRASS6.4.0RC5
checked out and compiled this morning on Fedora 11 2.6.30.9-90.fc11.x86_64
Any ideas? Am I doing something wrong or is this a bug? I've tried
several settings for the co1 and c02 and it crashes with every combination
I have tried.
Thanks for any help.
###########################################################
{{{
GRASS 6.4.0RC5 (CFR):/media/Data > r.le.patch -c map=patch sam=w co1=2
co2=c1
PARAMETER CHOICES:
MAP: patch
SAMPLE: whole map TRACING: 8 neighbor
OUTPUT MAPS:
interior
CORE MEASURES:
mean core size
R.LE.PATCH IS WORKING....;
*** glibc detected *** r.le.patch: double free or corruption (out):
0x0000000001c92be0 ***
======= Backtrace: =========
/lib64/libc.so.6[0x39e5e75a96]
r.le.patch(cell_clip+0x8fa)[0x417cea]
r.le.patch(cell_clip_drv+0x18c)[0x4180dc]
r.le.patch(patch_fore+0x98)[0x40c2d8]
r.le.patch(main+0x4fe)[0x40e61e]
/lib64/libc.so.6(__libc_start_main+0xfd)[0x39e5e1ea2d]
r.le.patch[0x403109]
======= Memory map: ========
00400000-0041d000 r-xp 00000000 fd:00 341102
/usr/local/grass-6.4.0RC5/bin/r.le.patch
0061d000-0061e000 rw-p 0001d000 fd:00 341102
/usr/local/grass-6.4.0RC5/bin/r.le.patch
01c4c000-01caf000 rw-p 00000000 00:00 0
[heap]
39e5a00000-39e5a1f000 r-xp 00000000 fd:00 45132
/lib64/ld-2.10.1.so
39e5c1e000-39e5c1f000 r--p 0001e000 fd:00 45132
/lib64/ld-2.10.1.so
39e5c1f000-39e5c20000 rw-p 0001f000 fd:00 45132
/lib64/ld-2.10.1.so
39e5e00000-39e5f64000 r-xp 00000000 fd:00 45133
/lib64/libc-2.10.1.so
39e5f64000-39e6164000 ---p 00164000 fd:00 45133
/lib64/libc-2.10.1.so
39e6164000-39e6168000 r--p 00164000 fd:00 45133
/lib64/libc-2.10.1.so
39e6168000-39e6169000 rw-p 00168000 fd:00 45133
/lib64/libc-2.10.1.so
39e6169000-39e616e000 rw-p 00000000 00:00 0
39e6200000-39e6282000 r-xp 00000000 fd:00 54274
/lib64/libm-2.10.1.so
39e6282000-39e6482000 ---p 00082000 fd:00 54274
/lib64/libm-2.10.1.so
39e6482000-39e6483000 r--p 00082000 fd:00 54274
/lib64/libm-2.10.1.so
39e6483000-39e6484000 rw-p 00083000 fd:00 54274
/lib64/libm-2.10.1.so
39e6600000-39e6602000 r-xp 00000000 fd:00 56013
/lib64/libdl-2.10.1.so
39e6602000-39e6802000 ---p 00002000 fd:00 56013
/lib64/libdl-2.10.1.so
39e6802000-39e6803000 r--p 00002000 fd:00 56013
/lib64/libdl-2.10.1.so
39e6803000-39e6804000 rw-p 00003000 fd:00 56013
/lib64/libdl-2.10.1.so
39e6a00000-39e6a15000 r-xp 00000000 fd:00 56006
/lib64/libz.so.1.2.3
39e6a15000-39e6c14000 ---p 00015000 fd:00 56006
/lib64/libz.so.1.2.3
39e6c14000-39e6c15000 rw-p 00014000 fd:00 56006
/lib64/libz.so.1.2.3
39f0400000-39f0419000 r-xp 00000000 fd:00 116332
/lib64/libgcc_s-4.4.1-20090729.so.1
39f0419000-39f0619000 ---p 00019000 fd:00 116332
/lib64/libgcc_s-4.4.1-20090729.so.1
39f0619000-39f061a000 rw-p 00019000 fd:00 116332
/lib64/libgcc_s-4.4.1-20090729.so.1
7f308a2da000-7f308f3ad000 r--p 00000000 fd:00 56067
/usr/lib/locale/locale-archive
7f308f3ad000-7f308f3b0000 rw-p 00000000 00:00 0
7f308f3d2000-7f308f3da000 r-xp 00000000 fd:00 358068
/usr/local/grass-6.4.0RC5/lib/libgrass_datetime.6.4.0RC5.so
7f308f3da000-7f308f5d9000 ---p 00008000 fd:00 358068
/usr/local/grass-6.4.0RC5/lib/libgrass_datetime.6.4.0RC5.so
7f308f5d9000-7f308f5da000 rw-p 00007000 fd:00 358068
/usr/local/grass-6.4.0RC5/lib/libgrass_datetime.6.4.0RC5.so
7f308f5da000-7f308f5db000 rw-p 00000000 00:00 0
7f308f5db000-7f308f62c000 r-xp 00000000 fd:00 358108
/usr/local/grass-6.4.0RC5/lib/libgrass_gis.6.4.0RC5.so
7f308f62c000-7f308f82c000 ---p 00051000 fd:00 358108
/usr/local/grass-6.4.0RC5/lib/libgrass_gis.6.4.0RC5.so
7f308f82c000-7f308f82e000 rw-p 00051000 fd:00 358108
/usr/local/grass-6.4.0RC5/lib/libgrass_gis.6.4.0RC5.so
7f308f82e000-7f308f838000 rw-p 00000000 00:00 0
7fffcf185000-7fffcf19a000 rw-p 00000000 00:00 0
[stack]
7fffcf1ee000-7fffcf1ef000 r-xp 0000000Aborted
}}}
It crashes with G_free() in trace.c line 339.
Comment (by neteler):
Here a backtrace:
{{{
GRASS 6.4.0svn (spearfish60):~ > r.le.patch -c map=patch sam=w co1=2
co2=c1
PARAMETER CHOICES:
MAP: patch
SAMPLE: whole map TRACING: 8 neighbor
OUTPUT MAPS:
interior
CORE MEASURES:
mean core size
R.LE.PATCH IS WORKING....;
Aborted patch 10
GRASS 6.4.0svn (spearfish60):~ > gdb r.le.patch
GNU gdb 6.8-6mdv2009.1 (Mandriva Linux release 2009.1)
...
This GDB was configured as "x86_64-mandriva-linux-gnu"...
(gdb) r -c map=patch sam=w co1=2 co2=c1
Starting program: /home/neteler/grass64/dist.x86_64-unknown-linux-
gnu/bin/r.le.patch -c map=patch sam=w co1=2 co2=c1
PARAMETER CHOICES:
MAP: patch
SAMPLE: whole map TRACING: 8 neighbor
OUTPUT MAPS:
interior
CORE MEASURES:
mean core size
R.LE.PATCH IS WORKING....;
Tracing patch 10
Program received signal SIGABRT, Aborted.
0x00007fe8a0f84a15 in raise () from /lib64/libc.so.6
(gdb) bt
#0 0x00007fe8a0f84a15 in raise () from /lib64/libc.so.6
#1 0x00007fe8a0f86243 in abort () from /lib64/libc.so.6
#2 0x00007fe8a0fc59d0 in ?? () from /lib64/libc.so.6
#3 0x00007fe8a196b1fa in G_free (buf=0x249aae0) at alloc.c:129
#4 0x0000000000417b49 in cell_clip_drv (col0=0, row0=0, ncols=100,
nrows=100, value=0x0, index=0, radius=0)
at trace.c:339
#5 0x000000000040d221 in whole_reg_driver () at driver.c:2816
#6 0x0000000000403342 in patch_fore () at driver.c:115
#7 0x000000000041014e in main (argc=6, argv=0x7fffe6d0f2d8) at main.c:197
(gdb) bt full
#0 0x00007fe8a0f84a15 in raise () from /lib64/libc.so.6
No symbol table info available.
#1 0x00007fe8a0f86243 in abort () from /lib64/libc.so.6
No symbol table info available.
#2 0x00007fe8a0fc59d0 in ?? () from /lib64/libc.so.6
No symbol table info available.
#3 0x00007fe8a196b1fa in G_free (buf=0x249aae0) at alloc.c:129
No locals.
#4 0x0000000000417b49 in cell_clip_drv (col0=0, row0=0, ncols=100,
nrows=100, value=0x0, index=0, radius=0)
at trace.c:339
pat = (CELL **) 0x7fe8a197bc00
pat_buf = (CELL *) 0x7fe8a1bc0a40
cor_cell_buf = (CELL *) 0x24b2ab0
cor_fcell_buf = (FCELL *) 0x7fffe6d0f180
buf = (DCELL **) 0x2470370
cor = (DCELL **) 0x249a790
cor_dcell_buf = (DCELL *) 0x7fe8a1ddf710
null_buf = (DCELL **) 0x2485580
i = 0
j = 101
fd = 1
fe = 8
p = 6423704
infd = 7
centernull = 1
empty = 0
hist_ok = 1
colr_ok = 1
cats_ok = 1
range_ok = 1
mapset = 0x7fe8a1bc0a40 "neteler"
name = 0x24674a0 "patch"
list_head = (PATCH *) 0x0
hist = {mapid = "Wed Nov 4 20:31:52 2009", '\0' <repeats 55
times>, title = "patch", '\0' <repeats 74 times>,
mapset = "neteler", '\0' <repeats 72 times>, creator = "neteler", '\0'
<repeats 72 times>,
maptype = "raster", '\0' <repeats 73 times>, datsrc_1 = '\0' <repeats 79
times>, datsrc_2 = '\0' <repeats 79 times>,
keywrd = "generated by r.grow", '\0' <repeats 60 times>, edlinecnt = 1,
edhist = {
"r.grow input=\"points\" output=\"patch\" radius=10
metric=\"euclidean\"", '\0' <repeats 14 times>,
'\0' <repeats 79 times> <repeats 49 times>}}
cats = {ncats = 219, num = 255, title = 0x24ba700 "Random points
on [surface in neteler]", fmt = 0x24ba8b0 "",
m1 = 0, a1 = 0, m2 = 0, a2 = 0, q = {truncate_only = 0, round_only = 0,
defaultDRuleSet = 1685287777,
defaultCRuleSet = 0, infiniteLeftSet = 0, infiniteRightSet = 0,
cRangeSet = -65536, maxNofRules = 250,
nofRules = 219, defaultDMin = 2.7027177092469472e-82, defaultDMax = 6.
9483966104968404e-310, defaultCMin = 0,
defaultCMax = 0, infiniteDLeft = 0, infiniteDRight =
3.914178569747262e+180, infiniteCLeft = 23, infiniteCRight = 0,
dMin = 1, dMax = 255, cMin = 0, cMax = 218, table = 0x24b4350,
fp_lookup = {vals = 0x0, rules = 0x7fffe6d0df10,
nalloc = -422519216, active = 0, inf_dmin = 2.1290593012604334e-317,
inf_dmax = 6.9533349326523867e-310,
inf_min = 4206800, inf_max = 0}}, labels = 0x24b07d0, marks =
0x24b0fe0, nalloc = 256, last_marked_rule = -1}
newcats = {ncats = 0, num = 0, title = 0x24b00c0 "Random points on
[surface in neteler]", fmt = 0x0, m1 = 0,
a1 = 0, m2 = 0, a2 = 0, q = {truncate_only = 0, round_only = 0,
defaultDRuleSet = 38184240, defaultCRuleSet = 0,
infiniteLeftSet = 0, infiniteRightSet = 0, cRangeSet = -422519248,
maxNofRules = 0, nofRules = 0, defaultDMin = 0,
defaultDMax = 6.9533349325994229e-310, defaultCMin = -422518352,
defaultCMax = 32767,
infiniteDLeft = -nan(0xfffffffffffff), infiniteDRight = 6.
9533349326547583e-310, infiniteCLeft = -422518352,
infiniteCRight = 32767, dMin = 6.953334932613652e-310, dMax = 6.
9483969725536792e-310, cMin = 0, cMax = 0,
table = 0x0, fp_lookup = {vals = 0x7fffe6d0e180, rules =
0x7fe8a0fb9619, nalloc = -72515583, active = 0,
inf_dmin = 6.9533349326547583e-310, inf_dmax = 6.9533349326547583e-
310, inf_min = -422518352, inf_max = 32767}},
labels = 0x0, marks = 0x7fffe6d0e1db, nalloc = 0, last_marked_rule = -1}
stats = {node = 0x24b00f0, tlen = 10, N = 3, curp = 0,
null_data_count = 8532, curoffset = -422518784}
colr = {version = 0, shift = 0, invert = 0, is_float = 0, null_set
= 0, null_red = 232 '\ufffd',
null_grn = 127 '\177', null_blu = 0 '\0', undef_set = 0, undef_red = 0
'\0', undef_grn = 0 '\0', undef_blu = 0 '\0',
fixed = {rules = 0x24bb7b0, n_rules = 1, lookup = {red = 0x1a19aa2a0
<Address 0x1a19aa2a0 out of bounds>,
grn = 0x7fe8a19aa2a0 "MASK", blu = 0x246a530 "-3.461977 -3.461977 to
-3.461977", set = 0x7fffe6d0ee20 "",
nalloc = -1583890387, active = 0}, fp_lookup = {vals = 0x0, rules =
0x7fe8a1bc0a40, nalloc = 0, active = 0},
min = 1, max = 255}, modular = {rules = 0x0, n_rules = 0, lookup =
{red = 0x7fffe6d0df10 "",
grn = 0x7fffe6d0de50 "\200\ufffd\ufffd\ufffd\ufffd\177", blu = 0x0,
set = 0x7fe8a19b101c "", nalloc = 1, active = 0}, fp_lookup = {
vals = 0x7fffe6d0d950, rules = 0xd, nalloc = 0, active = 0}, min =
0, max = -1}, cmin = 1, cmax = 255}
range = {min = 76, max = 171, first_time = 0}
fprange = {min = 2.1290593012604334e-317, max = 6.
9483969595155832e-310, first_time = 0}
quant = {truncate_only = -1583694900, round_only = 32744,
defaultDRuleSet = -1583694895,
defaultCRuleSet = 32744, infiniteLeftSet = -422519552, infiniteRightSet
= 32767, cRangeSet = 38188368,
maxNofRules = 0, nofRules = 38171648, defaultDMin = 1.8865940164224833e-
316, defaultDMax = 6.9533349327978397e-310,
defaultCMin = -1583818750, defaultCMax = 32744, infiniteDLeft = 6.
9533349325962609e-310,
infiniteDRight = 2.1219957904712067e-314, infiniteCLeft = 38188368,
infiniteCRight = 0,
dMin = 1.8859378972448062e-316, dMax = 6.9483969725914258e-310, cMin =
-1583694895, cMax = 32744,
table = 0x5002467400, fp_lookup = {vals = 0x246a880, rules =
0x7fffe6d0db60, nalloc = 4206800, active = 0,
inf_dmin = 6.9533349328713566e-310, inf_dmax = 0, inf_min = 0, inf_max
= 0}}
data_type = 0
#5 0x000000000040d221 in whole_reg_driver () at driver.c:2816
i = -422514224
j = 32767
regcnt = 0
found = 38171664
fr = 0
nrows = 100
ncols = 100
ptrfirst = (REGLIST *) 0x7fe8a1bc0a40
ptrthis = (REGLIST *) 0x24674a0
ptrnew = (REGLIST *) 0xfefefefefefefeff
row_buf = (CELL *) 0x2470370
#6 0x0000000000403342 in patch_fore () at driver.c:115
No locals.
#7 0x000000000041014e in main (argc=6, argv=0x7fffe6d0f2d8) at main.c:197
module = (struct GModule *) 0x7fe8a1bc0f40
}}}
--
Ticket URL: <http://trac.osgeo.org/grass/ticket/801#comment:1>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list