Skip to content

Segmentation fault in qgis_process when running PCRaster algorithms #55

Description

@florisvdh

When calling the QGIS CLI program qgis_process (which we call in R package qgisprocess) to run a PCRaster algorithm, the algorithm is run and the output is written, but in the end a segfault happens (which at the R side interrupts further handling in R and throws an error). It is specific to PCRaster, not seen for other QGIS processing providers.

I compiled and installed PCRaster from source in Linux Mint, using the Ubuntu guidelines at https://jvdkwast.github.io/qgis-processing-pcraster/. A Windows R user appeared to have similar results (r-spatial/qgisprocess#159).

I'm not sure whether this is to be solved on the PCRaster side alone, or also in qgis_process. Feel free to move this as appropriate.

Example below.

$ wget -q https://github.com/pcraster/pcraster/raw/master/data/demo/dem.map
$ 
$ myJSON=$(</dev/stdin)
{
  "inputs": {
    "INPUT": "dem.map",
    "OUTPUT": "dem_slope.map"
  }
}
$ 
$ echo "$myJSON" | qgis_process run pcraster:Slope -
/usr/lib/python3/dist-packages/qgis/utils.py:888: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
  mod = _builtin_import(name, globals, locals, fromlist, level)
{
  "algorithm_details": {
    "can_cancel": true,
    "deprecated": false,
    "group": "Derivatives of digital elevation models",
    "has_known_issues": false,
    "help_url": null,
    "id": "pcraster:Slope",
    "name": "slope",
    "requires_matching_crs": false,
    "short_description": null,
    "tags": []
  },
  "gdal_version": "3.6.2",
  "geos_version": "3.11.1-CAPI-1.17.1",
  "inputs": {
    "INPUT": "dem.map",
    "OUTPUT": "dem_slope.map"
  },
  "log": {},
  "proj_version": "Rel. 9.1.1, December 1st, 2022",
  "provider_details": {
    "can_be_activated": true,
    "default_raster_file_extension": "map",
    "default_vector_file_extension": "gpkg",
    "is_active": true,
    "long_name": "PCRaster",
    "name": "PCRaster",
    "supported_output_raster_extensions": [
      "map"
    ],
    "supported_output_table_extensions": [
      "gpkg",
      "shp",
      "000",
      "csv",
      "dgn",
      "dxf",
      "fgb",
      "gdb",
      "geojson",
      "geojsonl",
      "geojsons",
      "gml",
      "gpx",
      "gxt",
      "ili",
      "itf",
      "json",
      "kml",
      "ods",
      "sql",
      "sqlite",
      "tab",
      "txt",
      "xlsx",
      "xml",
      "xtf"
    ],
    "supported_output_vector_extensions": [
      "gpkg",
      "shp",
      "000",
      "csv",
      "dgn",
      "dxf",
      "fgb",
      "gdb",
      "geojson",
      "geojsonl",
      "geojsons",
      "gml",
      "gpx",
      "gxt",
      "ili",
      "itf",
      "json",
      "kml",
      "ods",
      "sql",
      "sqlite",
      "tab",
      "txt",
      "xlsx",
      "xml",
      "xtf"
    ],
    "supports_non_file_based_output": false,
    "version": "QGIS PCRaster Provider version 0.2.0"
  },
  "python_version": "3.10.6",
  "qgis_code_revision": "0992b53397",
  "qgis_version": "3.30.2-'s-Hertogenbosch",
  "qt_version": "5.15.3",
  "results": {
    "OUTPUT": "dem_slope.map"
  }
Segmentation fault (core dumped)
$ 
$ ls dem_slope.map 
dem_slope.map
$ 
$ qgis_process --version
QGIS 3.30.2-'s-Hertogenbosch ''s-Hertogenbosch' (0992b53397)
QGIS code revision 0992b53397
Qt version 5.15.3
Python version 3.10.6
GDAL/OGR version 3.6.2
PROJ version 9.1.1
EPSG Registry database version v10.076 (2022-08-31)
GEOS version 3.11.1-CAPI-1.17.1
SQLite version 3.37.2
OS Linux Mint 21.1
$ 
$ python
Python 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pcraster as pcr
>>> pcr.__version__
'4.5.0-dev'
>>> exit()
$ 
$ echo $PYTHONPATH
:/usr/local/python
$ 
$ which qgis_process
/usr/bin/qgis_process
$ 
$ apt policy qgis
qgis:
  Installed: 1:3.30.2+36jammy-ubuntugis
  Candidate: 1:3.30.2+36jammy-ubuntugis
  Version table:
 *** 1:3.30.2+36jammy-ubuntugis 500
        500 https://qgis.org/ubuntugis jammy/main amd64 Packages
        100 /var/lib/dpkg/status
     3.22.16+dfsg-1~jammy3 500
        500 http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu jammy/main amd64 Packages
     3.22.4+dfsg-3build1 500
        500 http://ftp.belnet.be/ubuntu jammy/universe amd64 Packages
$ 

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions