[GRASS-dev] [GRASS GIS] #3676: Errors when running r.li.* modules

#3676: Errors when running r.li.* modules
-----------------------------+-------------------------
Reporter: veroandreo | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.6.0
Component: Raster | Version: svn-trunk
Keywords: r.li, landscape | CPU: x86-64
Platform: Linux |
-----------------------------+-------------------------
I get different errors when trying to run different r.li.* modules. Here
some examples:

{{{
r.li.shannon --overwrite input=landclass96 at PERMANENT
config=forest_mov_win
output=forest_mov_win_sh
munmap_chunk(): invalid pointer
}}}

The map is created but cannot be read or displayed:

{{{
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)

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>
}}}

Further attempts:

{{{
r.mapcalc "forest = if(landclass96 == 5, 1, null())"
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.

Instead, if I do something equivalent:

{{{
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)

r.univar forest_edge
WARNING: LZ4 decompression error
ERROR: Error uncompressing null data for row 474 of <forest_edge>
}}}

I attach the config file for reproducibility. And here's the thread in
grass-dev: https://lists.osgeo.org/pipermail/grass-
dev/2018-October/090155.html with Markus' valgrind test.

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

#3676: Errors when running r.li.* modules
-------------------------+-----------------------------
  Reporter: veroandreo | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.6.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.li, landscape
       CPU: x86-64 | Platform: Linux
-------------------------+-----------------------------
Changes (by veroandreo):

* Attachment "forest_mov_win" added.

config file created with g.gui.rlisetup

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

#3676: Errors when running r.li.* modules
-------------------------+-----------------------------
  Reporter: veroandreo | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.6.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.li, landscape
       CPU: x86-64 | Platform: Linux
-------------------------+-----------------------------

Comment (by veroandreo):

Here the results using grass74 relbranch:

{{{
GRASS 7.4.2svn (nc_spm_08_grass7):~ > r.li.shannon --overwrite
input=landclass96@PERMANENT config=forest_mov_win output=forest_mov_win_sh
munmap_chunk(): invalid pointer
Aborted (core dumped)

GRASS 7.4.2svn (nc_spm_08_grass7):~ > d.rast forest_mov_win_sh
WARNING: LZ4 decompression error
ERROR: Error uncompressing null data for row 473 of <forest_mov_win_sh>

GRASS 7.4.2svn (nc_spm_08_grass7):~ > r.mapcalc "forest = if(landclass96
== 5, 1, null())" --o
GRASS 7.4.2svn (nc_spm_08_grass7):~ > r.li.edgedensity input=forest
config=forest_mov_win output=forest_edge_mw --o
corrupted size vs. prev_size
Aborted (core dumped)

r.li.edgedensity --verbose input=landclass96@PERMANENT
config=forest_mov_win output=forest_edge patch_type=5 --o
r.li.edgedensity complete. Raster map <forest_edge> created.
}}}

The last one worked... no idea

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

#3676: Errors when running r.li.* modules
-------------------------+-----------------------------
  Reporter: veroandreo | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.6.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.li, landscape
       CPU: x86-64 | Platform: Linux
-------------------------+-----------------------------

Comment (by mmetz):

In [changeset:"73488" 73488]:
{{{
#!CommitTicketReference repository="" revision="73488"
r.li: fix segfault in r.li.shannon (see #3676)
}}}

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

#3676: Errors when running r.li.* modules
-------------------------+-----------------------------
  Reporter: veroandreo | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.6.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.li, landscape
       CPU: x86-64 | Platform: Linux
-------------------------+-----------------------------

Comment (by mmetz):

In [changeset:"73489" 73489]:
{{{
#!CommitTicketReference repository="" revision="73489"
r.li: fix segfault in r.li.shannon (see #3676, backport trunk r73488)
}}}

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

#3676: Errors when running r.li.* modules
-------------------------+-----------------------------
  Reporter: veroandreo | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.6.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.li, landscape
       CPU: x86-64 | Platform: Linux
-------------------------+-----------------------------

Comment (by mmetz):

In [changeset:"73490" 73490]:
{{{
#!CommitTicketReference repository="" revision="73490"
r.li: fix segfault in r.li.shannon (see #3676, backport trunk r73488)
}}}

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

#3676: Errors when running r.li.* modules
-------------------------+-----------------------------
  Reporter: veroandreo | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: normal | Milestone: 7.6.0
Component: Raster | Version: svn-trunk
Resolution: | Keywords: r.li, landscape
       CPU: x86-64 | Platform: Linux
-------------------------+-----------------------------

Comment (by mmetz):

The reason was that excessive rows were written to the output, causing
memory corruption. Valgrind output is now clean for the mentioned test
case and test commands, including the test commands with r.li.edgedensity.

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

#3676: Errors when running r.li.* modules
-------------------------+-----------------------------
  Reporter: veroandreo | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.6.0
Component: Raster | Version: svn-trunk
Resolution: fixed | Keywords: r.li, landscape
       CPU: x86-64 | Platform: Linux
-------------------------+-----------------------------
Changes (by veroandreo):

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

Comment:

Tested in trunk and 74 relbranch, no more errors. Thanks! Closing

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

#3676: Errors when running r.li.* modules
-------------------------+-----------------------------
  Reporter: veroandreo | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.4.2
Component: Raster | Version: svn-trunk
Resolution: fixed | Keywords: r.li, landscape
       CPU: x86-64 | Platform: Linux
-------------------------+-----------------------------
Changes (by martinl):

* milestone: 7.6.0 => 7.4.2

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