[GRASS-dev] [GRASS GIS] #3285: r.viewshed crashes when using DEM linked with r.external
GRASS GIS
trac at osgeo.org
Mon Feb 13 13:02:51 PST 2017
#3285: r.viewshed crashes when using DEM linked with r.external
------------------------------------+---------------------------------
Reporter: neteler | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone: 7.2.1
Component: Raster | Version: svn-releasebranch72
Keywords: r.viewshed, r.external | CPU: x86-64
Platform: Unspecified |
------------------------------------+---------------------------------
As a followup of http://hub.qgis.org/issues/15787
{{{
# test case
grass72 ~/grassdata/nc_spm_08_grass7/user1/
g.region raster=elevation
r.out.gdal input=elevation output=nc_elevation.tif
create="COMPRESS=DEFLATE"
r.external input=~/nc_elevation.tif output=nc_elevation
g.region -c
center easting: 637500.000000
center northing: 221750.000000
r.viewshed input=nc_elevation coordinates=637500.0,221750.0
output=viewshed
Computing events...
100%
*** Error in `r.viewshed': free(): invalid pointer: 0x0000000002371d78 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x791fb)[0x7f93ac19d1fb]
/lib64/libc.so.6(+0x8288a)[0x7f93ac1a688a]
/lib64/libc.so.6(cfree+0x4c)[0x7f93ac1aa2bc]
r.viewshed(_ZdlPv+0xfc)[0x42387a]
/lib64/libgdal.so.20(_ZN23GDALArrayBandBlockCache10FlushBlockEiii+0xba)[0x7f9398bafbda]
/lib64/libgdal.so.20(_ZN23GDALArrayBandBlockCache10FlushCacheEv+0x7b)[0x7f9398bafc6b]
/lib64/libgdal.so.20(_ZN11GDALDataset10FlushCacheEv+0x53)[0x7f9398bc2933]
/lib64/libgdal.so.20(_ZN14GDALPamDataset10FlushCacheEv+0x9)[0x7f9398bed249]
/lib64/libgdal.so.20(_ZN12GTiffDataset18FlushCacheInternalEb+0x31)[0x7f9398946c21]
/lib64/libgdal.so.20(_ZN12GTiffDataset8FinalizeEv+0x9a)[0x7f939893dcba]
/lib64/libgdal.so.20(_ZN12GTiffDatasetD1Ev+0x17)[0x7f939893e107]
/lib64/libgdal.so.20(_ZN12GTiffDatasetD0Ev+0x9)[0x7f939893e1b9]
/home/neteler/software/grass72/dist.x86_64-pc-linux-
gnu/lib/libgrass_raster.7.2.1svn.so(Rast_close_gdal_link+0xe)[0x7f93acfecd2e]
/home/neteler/software/grass72/dist.x86_64-pc-linux-
gnu/lib/libgrass_raster.7.2.1svn.so(+0xbe5f)[0x7f93acfe4e5f]
r.viewshed(_Z25init_event_list_in_memoryP6event_PcP10viewpoint_P11grid_header12viewOptions_PPPfP23memory_visibility_grid_+0xce8)[0x41567f]
r.viewshed(_Z18viewshed_in_memoryPcP11grid_headerP10viewpoint_12viewOptions_+0x222)[0x41c566]
r.viewshed(main+0x569)[0x4180ad]
/lib64/libc.so.6(__libc_start_main+0xf1)[0x7f93ac144401]
r.viewshed(_start+0x2a)[0x408caa]
======= Memory map: ========
00400000-0042f000 r-xp 00000000 08:03 24529208
/home/neteler/software/grass72/dist.x86_64-pc-linux-gnu/bin/r.viewshed
0062f000-00630000 r--p 0002f000 08:03 24529208
/home/neteler/software/grass72/dist.x86_64-pc-linux-gnu/bin/r.viewshed
00630000-00631000 rw-p 00030000 08:03 24529208
/home/neteler/software/grass72/dist.x86_64-pc-linux-gnu/bin/r.viewshed
00631000-00633000 rw-p 00000000 00:00 0
01b06000-02b77000 rw-p 00000000 00:00 0
[heap]
7f9370000000-7f9370021000 rw-p 00000000 00:00 0
7f9370021000-7f9374000000 ---p 00000000 00:00 0
7f9377a70000-7f9377a77000 r-xp 00000000 08:04 2753232
/usr/lib/gdalplugins/gdal_GRASS.so
7f9377a77000-7f9377c77000 ---p 00007000 08:04 2753232
/usr/lib/gdalplugins/gdal_GRASS.so
7f9377c77000-7f9377c78000 r--p 00007000 08:04 2753232
/usr/lib/gdalplugins/gdal_GRASS.so
7f9377c78000-7f9377c79000 rw-p 00008000 08:04 2753232
/usr/lib/gdalplugins/gdal_GRASS.so
7f9377c79000-7f9377e65000 r-xp 00000000 08:04 1969032
/usr/lib64/libfftw3.so.3.5.5
7f9377e65000-7f9378064000 ---p 001ec000 08:04 1969032
/usr/lib64/libfftw3.so.3.5.5
7f9378064000-7f9378075000 r--p 001eb000 08:04 1969032
/usr/lib64/libfftw3.so.3.5.5
7f9378075000-7f9378076000 rw-p 001fc000 08:04 1969032
/usr/lib64/libfftw3.so.3.5.5
7f9378076000-7f9378084000 r-xp 00000000 08:04 1984818
/usr/lib64/libgrass_ccmath.7.2.0.so
7f9378084000-7f9378284000 ---p 0000e000 08:04 1984818
/usr/lib64/libgrass_ccmath.7.2.0.so
7f9378284000-7f9378285000 r--p 0000e000 08:04 1984818
/usr/lib64/libgrass_ccmath.7.2.0.so
7f9378285000-7f9378286000 rw-p 00000000 00:00 0
7f9378286000-7f937828b000 r-xp 00000000 08:04 1984168
/usr/lib64/libgrass_btree2.7.2.0.so
7f937828b000-7f937848b000 ---p 00005000 08:04 1984168
/usr/lib64/libgrass_btree2.7.2.0.so
7f937848b000-7f937848c000 r--p 00005000 08:04 1984168
/usr/lib64/libgrass_btree2.7.2.0.so
7f937848c000-7f937848d000 rw-p 00000000 00:00 0
7f937848d000-7f9378495000 r-xp 00000000 08:04 1984916
/usr/lib64/libgrass_datetime.7.2.0.so
7f9378495000-7f9378694000 ---p 00008000 08:04 1984916
/usr/lib64/libgrass_datetime.7.2.0.so
7f9378694000-7f9378695000 r--p 00007000 08:04 1984916
/usr/lib64/libgrass_datetime.7.2.0.so
7f9378695000-7f9378696000 rw-p 00000000 00:00 0
7f9378696000-7f93786dc000 r-xp 00000000 08:04 1985336
/usr/lib64/libgrass_gis.7.2.0.so
7f93786dc000-7f93788db000 ---p 00046000 08:04 1985336
/usr/lib64/libgrass_gis.7.2.0.so
7f93788db000-7f93788dd000 r--p 00045000 08:04 1985336
/usr/lib64/libgrass_gis.7.2.0.so
7f93788dd000-7f93788de000 rw-p 00047000 08:04 1985336
/usr/lib64/libgrass_gis.7.2.0.so
7f93788de000-7f93788f1000 r-xp 00000000 08:04 1985347
/usr/lib64/libgrass_gmath.7.2.0.so
7f93788f1000-7f9378af0000 ---p 00013000 08:04 1985347
/usr/lib64/libgrass_gmath.7.2.0.so
7f9378af0000-7f9378af1000 r--p 00012000 08:04 1985347
/usr/lib64/libgrass_gmath.7.2.0.so
7f9378af1000-7f9378af2000 rw-p 00013000 08:04 1985347
/usr/lib64/libgrass_gmath.7.2.0.so
7f9378af2000-7f9378afa000 r-xp 00000000 08:04 1985365
/usr/lib64/libgrass_gproj.7.2.0.so
7f9378afa000-7f9378cf9000 ---p 00008000 08:04 1985365
/usr/lib64/libgrass_gproj.7.2.0.so
7f9378cf9000-7f9378cfa000 r--p 00007000 08:04 1985365
/usr/lib64/libgrass_gproj.7.2.0.so
7f9378cfa000-7f9378cfb000 rw-p 00008000 08:04 1985365
/usr/lib64/libgrass_gproj.7.2.0.so
7f9378cfb000-7f9378d0c000 r-xp 00000000 08:04 1985380
/usr/lib64/libgrass_imagery.7.2.0.so
7f9378d0c000-7f9378f0b000 ---p 00011000 08:04 1985380
/usr/lib64/libgrass_imagery.7.2.0.so
7f9378f0b000-7f9378f0c000 r--p 00010000 08:04 1985380
/usr/lib64/libgrass_imagery.7.2.0.so
7f9378f0c000-7f9378f0d000 rw-p 00000000 00:00 0
7f9378f0d000-7f9378f36000 r-xp 00000000 08:04 1987849
/usr/lib64/libgrass_raster.7.2.0.so
7f9378f36000-7f9379136000 ---p 00029000 08:04 1987849
/usr/lib64/libgrass_raster.7.2.0.so
7f9379136000-7f9379137000 r--p 00029000 08:04 1987849
/usr/lib64/libgrass_raster.7.2.0.so
7f9379137000-7f9379138000 rw-p 0002a000 08:04 1987849
/usr/lib64/libgrass_raster.7.2.0.so
7f9379138000-7f9379149000 r-xp 00000000 08:04 1984919
/usr/lib64/libgrass_dbmibase.7.2.0.so
7f9379149000-7f9379348000 ---p 00011000 08:04 1984919
/usr/lib64/libgrass_dbmibase.7.2.0.so
7f9379348000-7f9379349000 r--p 00010000 08:04 1984919
/usr/lib64/libgrass_dbmibase.7.2.0.so
7f9379349000-7f937934a000 rw-p 00011000 08:04 1984919
/usr/lib64/libgrass_dbmibase.7.2.0.so
7f937934a000-7f9379354000 r-xp 00000000 08:04 1984923
/usr/lib64/libgrass_dbmiclient.7.2.0.so
7f9379354000-7f9379553000 ---p 0000a000 08:04 1984923
/usr/lib64/libgrass_dbmiclient.7.2.0.so
7f9379553000-7f9379554000 r--p 00009000 08:04 1984923
/usr/lib64/libgrass_dbmiclient.7.2.0.so
7f9379554000-7f9379555000 rw-p 00000000 00:00 0
7f9379555000-7f9379556000 r-xp 00000000 08:04 1985696
/usr/lib64/libgrass_linkm.7.2.0.so
7f9379556000-7f9379756000 ---p 00001000 08:04 1985696
/usr/lib64/libgrass_linkm.7.2.0.so
7f9379756000-7f9379757000 r--p 00001000 08:04 1985696
/usr/lib64/libgrass_linkm.7.2.0.so
7f9379757000-7f9379758000 rw-p 00002000 08:04 1985696
/usr/lib64/libgrass_linkm.7.2.0.so
7f9379758000-7f9379761000 r-xp 00000000 08:04 1988812
/usr/lib64/libgrass_rtree.7.2.0.so
7f9379761000-7f9379961000 ---p 00009000 08:04 1988812
/usr/lib64/libgrass_rtree.7.2.0.so
7f9379961000-7f9379962000 r--p 00009000 08:04 1988812
/usr/lib64/libgrass_rtree.7.2.0.so
7f9379962000-7f9379963000 rw-p 00000000 00:00 0
7f9379963000-7f937997b000 r-xp 00000000 08:04 1984953
[...]
7f9386f53000-7f9386f54000 rw-p 00000000 00:00 0
7f9386f54000-7f9386f77000 r-xp 00000000 08:04 1990869
/usr/lib64/libnghttp2.so.14.9.0
7f9386f77000-7f9387176000 ---p 00023000 08:04 1990869
/usr/lib64/libnghttp2.so.14.9.0
7f9387176000-7f9387177000 r--p 00022000 08:04 1990869
/usr/lib64/libnghttp2.so.14.9.0
7f9387177000-7f9387179000 rw-p 00023000 08:04 1990869
/usr/lib64/libnghttp2.so.14.9.0
7f9387179000-7f938717d000 r-xp 00000000 08:04 1998466
/usr/lib64/libuuid.so.1.3.0
7f938717d000-7f938737c000 ---p 00004000 08:04 1998466
/usr/lib64/libuuid.so.1.3.0
7f938737c000-7f938737d000 r--p 00003000 08:04 1998466
/usr/lib64/libuuid.so.1.3.0
7f938737d000-7f938737e000 rw-p 00000000 00:00 0
7f938737e000-7f93873d3000 r-xp 00000000 08:04 2020800
/usr/lib64/libldap_r-2.4.so.2.10.7Aborted (core dumped)
}}}
A quick gdb (I'd need to recompile with debugging symbols "on" but maybe
it already indicates the problematic code area):
{{{
(gdb) bt
#0 0x00007ffff6d2d91f in raise () from /lib64/libc.so.6
#1 0x00007ffff6d2f51a in abort () from /lib64/libc.so.6
#2 0x00007ffff6d71200 in __libc_message () from /lib64/libc.so.6
#3 0x00007ffff6d7a88a in _int_free () from /lib64/libc.so.6
#4 0x00007ffff6d7e2bc in free () from /lib64/libc.so.6
#5 0x000000000042387a in operator delete (ptr=0xe9edc0) at mm.cpp:427
#6 0x00007fffe3783bda in GDALArrayBandBlockCache::FlushBlock(int, int,
int) () from /lib64/libgdal.so.20
#7 0x00007fffe3783c6b in GDALArrayBandBlockCache::FlushCache() () from
/lib64/libgdal.so.20
#8 0x00007fffe3796933 in GDALDataset::FlushCache() () from
/lib64/libgdal.so.20
#9 0x00007fffe37c1249 in GDALPamDataset::FlushCache() () from
/lib64/libgdal.so.20
#10 0x00007fffe351ac21 in GTiffDataset::FlushCacheInternal(bool) () from
/lib64/libgdal.so.20
#11 0x00007fffe3511cba in GTiffDataset::Finalize() () from
/lib64/libgdal.so.20
#12 0x00007fffe3512107 in GTiffDataset::~GTiffDataset() () from
/lib64/libgdal.so.20
#13 0x00007fffe35121b9 in GTiffDataset::~GTiffDataset() () from
/lib64/libgdal.so.20
#14 0x00007ffff7bc0d2e in Rast_close_gdal_link () from
/home/neteler/software/grass72/dist.x86_64-pc-linux-
gnu/lib/libgrass_raster.7.2.1svn.so
#15 0x00007ffff7bb8e5f in close_old () from
/home/neteler/software/grass72/dist.x86_64-pc-linux-
gnu/lib/libgrass_raster.7.2.1svn.so
#16 0x000000000041567f in init_event_list_in_memory
(eventList=0x7fffe42ac010, rastName=0x7fffffffc5c0 "nc_elevation",
vp=0x7fffffffc5b0, hd=0x647170, viewOptions=...,
data=0x7fffffffa980, visgrid=0x647360) at grass.cpp:373
#17 0x000000000041c566 in viewshed_in_memory (inputfname=0x7fffffffc5c0
"nc_elevation", hd=0x647170, vp=0x7fffffffc5b0, viewOptions=...) at
viewshed.cpp:230
#18 0x00000000004180ad in main (argc=4, argv=0x7fffffffd9b8) at
main.cpp:252
}}}
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3285>
GRASS GIS <https://grass.osgeo.org>
More information about the grass-dev
mailing list