[GRASS-dev] Errors with r.li.* modules

Hi devs,

I’m trying to use r.li.* modules to develop an example for a course. I am currently working in trunk, though I had to create the config files in 74 rel branch because I get an error in trunk (reported already in [0]).

Now, when I try to use r.li.shannon for example (though it happens with other modules as well), I get the following error:

r.li.shannon --overwrite input=landclass96@PERMANENT config=forest_mov_win output=forest_mov_win_sh
munmap_chunk(): invalid pointer <<<— THIS

The map is created but not displayed, with errors related to decompression in the GUI console:

Failed to run command ‘d.rast map=forest_mov_win_sh@user1’. Details:

GRASS_INFO_WARNING(12641,1): LZ4 decompression error
GRASS_INFO_END(12641,1)

GRASS_INFO_ERROR(12641,2): Error uncompressing null data for row 474 of <forest_mov_win_sh>
GRASS_INFO_END(12641,2)

Also…

GRASS 7.7.svn (nc_spm_08_grass7):~ > r.univar forest_mov_win_sh
WARNING: LZ4 decompression error
ERROR: Error uncompressing null data for row 474 of <forest_mov_win_sh>

Why is this? I didn’t set any env var for compression.

A different case is:

GRASS 7.7.svn (nc_spm_08_grass7):~ > r.mapcalc “forest = if(landclass96 == 5, 1, null())”
GRASS 7.7.svn (nc_spm_08_grass7):~ > r.li.edgedensity input=forest config=forest_mov_win output=forest_edge_mw
double free or corruption (!prev) <<<— THIS
Aborted (core dumped)
… but map is created and no error related to compression.

Doing something equivalent, I get a different error (same as the first one):

r.li.edgedensity --verbose input=landclass96@PERMANENT config=forest_mov_win output=forest_edge patch_type=5
munmap_chunk(): invalid pointer <<<— THIS
Aborted (core dumped)

GRASS 7.7.svn (nc_spm_08_grass7):~ > r.univar forest_edge
WARNING: LZ4 decompression error
ERROR: Error uncompressing null data for row 474 of <forest_edge>

What am I doing wrong? Does anyone know the trick to use these modules?

Thanks much in advance,

Vero

[0] https://trac.osgeo.org/grass/ticket/3675

I forgot to attach the config file for reproducibility. Here is it :slight_smile:

It should be stored in .grass7/r.li/ and according to manual, no full path should be used for the config file.

Thanks in advance,
Vero

El vie., 5 oct. 2018 a las 3:40, Veronica Andreo (<veroandreo@gmail.com>) escribió:

Hi devs,

I’m trying to use r.li.* modules to develop an example for a course. I am currently working in trunk, though I had to create the config files in 74 rel branch because I get an error in trunk (reported already in [0]).

Now, when I try to use r.li.shannon for example (though it happens with other modules as well), I get the following error:

r.li.shannon --overwrite input=landclass96@PERMANENT config=forest_mov_win output=forest_mov_win_sh
munmap_chunk(): invalid pointer <<<— THIS

The map is created but not displayed, with errors related to decompression in the GUI console:

Failed to run command ‘d.rast map=forest_mov_win_sh@user1’. Details:

GRASS_INFO_WARNING(12641,1): LZ4 decompression error
GRASS_INFO_END(12641,1)

GRASS_INFO_ERROR(12641,2): Error uncompressing null data for row 474 of <forest_mov_win_sh>
GRASS_INFO_END(12641,2)

Also…

GRASS 7.7.svn (nc_spm_08_grass7):~ > r.univar forest_mov_win_sh
WARNING: LZ4 decompression error
ERROR: Error uncompressing null data for row 474 of <forest_mov_win_sh>

Why is this? I didn’t set any env var for compression.

A different case is:

GRASS 7.7.svn (nc_spm_08_grass7):~ > r.mapcalc “forest = if(landclass96 == 5, 1, null())”
GRASS 7.7.svn (nc_spm_08_grass7):~ > r.li.edgedensity input=forest config=forest_mov_win output=forest_edge_mw
double free or corruption (!prev) <<<— THIS
Aborted (core dumped)
… but map is created and no error related to compression.

Doing something equivalent, I get a different error (same as the first one):

r.li.edgedensity --verbose input=landclass96@PERMANENT config=forest_mov_win output=forest_edge patch_type=5
munmap_chunk(): invalid pointer <<<— THIS
Aborted (core dumped)

GRASS 7.7.svn (nc_spm_08_grass7):~ > r.univar forest_edge
WARNING: LZ4 decompression error
ERROR: Error uncompressing null data for row 474 of <forest_edge>

What am I doing wrong? Does anyone know the trick to use these modules?

Thanks much in advance,

Vero

[0] https://trac.osgeo.org/grass/ticket/3675

(attachments)

forest_mov_win (93 Bytes)

On Fri, Oct 5, 2018 at 3:40 AM Veronica Andreo <veroandreo@gmail.com> wrote:

Hi devs,

I'm trying to use r.li.* modules to develop an example for a course. I am currently working in trunk, though I had to create the config files in 74 rel branch because I get an error in trunk (reported already in [0]).

Now, when I try to use r.li.shannon for example (though it happens with other modules as well), I get the following error:

r.li.shannon --overwrite input=landclass96@PERMANENT config=forest_mov_win output=forest_mov_win_sh
munmap_chunk(): invalid pointer <<<--- THIS

Here the result of a valgrind test:

GRASS 7.7.svn (nc_spm_08_grass7):~ >

g.region raster=landclass96

CMD="r.li.shannon --overwrite input=landclass96@PERMANENT
config=forest_mov_win output=forest_mov_win_sh"

valgrind --tool=massif $CMD --o
==3373== Massif, a heap profiler
==3373== Copyright (C) 2003-2017, and GNU GPL'd, by Nicholas Nethercote
==3373== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==3373== Command: r.li.shannon --overwrite input=landclass96@PERMANENT
config=forest_mov_win output=forest_mov_win_sh --o
==3373==

valgrind: m_mallocfree.c:307 (get_bszB_as_is): Assertion 'bszB_lo ==
bszB_hi' failed.
valgrind: Heap block lo/hi size mismatch: lo = 3840, hi = 9513.
This is probably caused by your program erroneously writing past the
end of a heap block and corrupting heap metadata. If you fix any
invalid writes reported by Memcheck, this assertion failure will
probably go away. Please try that before reporting this as a bug.

host stacktrace:
==3373== at 0x58007B42: ??? (in /usr/lib64/valgrind/massif-amd64-linux)
==3373== by 0x58007C54: ??? (in /usr/lib64/valgrind/massif-amd64-linux)
==3373== by 0x58007DE4: ??? (in /usr/lib64/valgrind/massif-amd64-linux)
==3373== by 0x58014A89: ??? (in /usr/lib64/valgrind/massif-amd64-linux)
==3373== by 0x5805F05B: ??? (in /usr/lib64/valgrind/massif-amd64-linux)
==3373== by 0x5806E2AA: ??? (in /usr/lib64/valgrind/massif-amd64-linux)

sched status:
  running_tid=1

Thread 1: status = VgTs_Runnable (lwpid 3373)
==3373== at 0x4C2E15C: free (vg_replace_malloc.c:530)
==3373== by 0x5047333: close_new (in
/home/mneteler/software/grass77/dist.x86_64-pc-linux-gnu/lib/libgrass_raster.7.7.svn.so)
==3373== by 0x4E366BE: calculateIndex (in
/home/mneteler/software/grass77/dist.x86_64-pc-linux-gnu/lib/libgrass_rli.7.7.svn.so)
==3373== by 0x586C11A: (below main) (in /usr/lib64/libc-2.27.so)

Worth a ticket I believe.

Best
Markus