Aborted (core dumped) with `filter1d`

Open
#4,472 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Quiet
Tech stack
numpy, pandas, python
Domain
backend

Research direction

Start with the provided pygmt.filter1d minimal example and reproduce it in the MKL and OpenBLAS environments. Investigate the filter1d memory cleanup indicated by the debug output and compare the environment differences; it is done when the MKL case no longer aborts and produces the expected filtered result without regressing the working OpenBLAS case.

Written by the indexing model from the issue text.

Description

bug
Description of the problem

I'm experiencing a free(): invalid next size (fast) error when I run pygmt.filter1d. I've tested lots of environment variations with the below Minimal Complete Verifiable Examples. I can reliably reproduce the issues with an environment made with:

mamba env create -n pygmt_mkl python==3.14.3 numpy==2.4.3 pandas==3.0.1 pygmt==0.18.0 liblapack=*=*mkl

while an environment made with the below works as expected:

mamba env create -n pygmt_openblas python==3.14.3 numpy==2.4.3 pandas==3.0.1 pygmt==0.18.0 liblapack=*=*openblas

These seems to indicate it's a similar issue to #4038.

Outputs from working environment:

PyGMT information:
  version: v0.18.0
System information:
  python: 3.14.3 | packaged by conda-forge | (main, Feb  9 2026, 21:56:02) [GCC 14.3.0]
  executable: /home/sungw937/miniforge3/envs/pygmt_openblas/bin/python
  machine: Linux-5.15.167.4-microsoft-standard-WSL2-x86_64-with-glibc2.39
Dependency information:
  numpy: 2.4.3
  pandas: 3.0.1
  xarray: 2026.2.0
  packaging: 26.0
  contextily: None
  geopandas: None
  IPython: None
  pyarrow: None
  rioxarray: None
  gdal: 3.12.3
  ghostscript: 10.06.0
GMT library information:
  version: 6.6.0
  padding: 2
  share dir: /home/sungw937/miniforge3/envs/pygmt_openblas/share/gmt
  plugin dir: /home/sungw937/miniforge3/envs/pygmt_openblas/lib/gmt/plugins
  library path: /home/sungw937/miniforge3/envs/pygmt_openblas/lib/libgmt.so
  cores: 8
  grid layout: rows
  image layout: 
  binary version: 6.6.0
pygmt-session [DEBUG]: Revised options: @GMTAPI@-S-I-D-V-T-N-000000 -Fg1000 -N0 -Vd ->@GMTAPI@-S-O-D-D-A-Y-000001
filter1d [DEBUG]: Look for file 1000 in /home/sungw937/.gmt
filter1d [DEBUG]: Look for file 1000 in /home/sungw937/.gmt/cache
filter1d [DEBUG]: Look for file 1000 in /home/sungw937/.gmt/server
filter1d [INFORMATION]: Processing input table data
filter1d [DEBUG]: gmtapi_init_import: Passed family = Data Table and geometry = Line
filter1d [DEBUG]: gmtapi_init_import: Added 1 new sources
filter1d [DEBUG]: GMT_Init_IO: Returned first Input object ID = 0
filter1d [DEBUG]: gmtapi_begin_io: Input resource access is now enabled [container]
filter1d [DEBUG]: gmtapi_import_dataset: Passed ID = -1 and mode = 0
filter1d [INFORMATION]: Referencing data table from user 2 column arrays of length 1000
filter1d [DEBUG]: Object ID 2 : Registered Data Table Memory Reference 55a874c98030 as an Input resource with geometry Point [n_objects = 3]
filter1d [DEBUG]: gmtapi_import_dataset processed 1 resources
filter1d [DEBUG]: GMT_End_IO: Input resource access is now disabled
filter1d [DEBUG]: gmtapi_init_export: Passed family = Data Table and geometry = Line
filter1d [DEBUG]: gmtapi_init_export: Added 1 new destination
filter1d [DEBUG]: GMT_Init_IO: Returned first Output object ID = 1
filter1d [DEBUG]: GMT_Begin_IO: Mode value 1 not considered (ignored)
filter1d [DEBUG]: GMT_Begin_IO: Initialize record-by-record access for Output
filter1d [DEBUG]: gmtapi_next_io_source: Selected object 1
filter1d [INFORMATION]: Writing Data Table to memory copy supplied by pointer
filter1d [DEBUG]: GMT_Begin_IO: Output resource access is now enabled [record-by-record]
filter1d [DEBUG]: GMTAPI: GMT_Set_Geometry called but no object available
filter1d [INFORMATION]: Filter the data columns
filter1d [INFORMATION]: Read 1000 records from table 0, segment 0
filter1d [INFORMATION]: F width: 1000 Resolution: 10.01 Start: 500.501 Stop: 9499.5
filter1d [DEBUG]: GMTAPI: GMT_Put_Record (double) called before any segments declared
filter1d [DEBUG]: GMT memory: Initialize 2 temporary column double arrays, each of length : 0
filter1d [DEBUG]: Object ID 3 : Registered Data Table Memory Reference 55a874960570 as an Output resource with geometry Point|Line|Poly [n_objects = 4]
filter1d [DEBUG]: GMT_End_IO: Output resource access is now disabled
filter1d [DEBUG]: gmtlib_garbage_collection: Destroying object: C=0 A=0 ID=2 W=Input F=Data Table M=Memory Reference S=Used P=55a874c98030 N=(null)
filter1d [DEBUG]: GMTAPI_Garbage_Collection freed 1 memory objects
filter1d [DEBUG]: gmtlib_unregister_io: Unregistering object no 2 [n_objects = 3]
filter1d [DEBUG]: gmtlib_unregister_io: Unregistering object no 3 [n_objects = 2]
filter1d [DEBUG]: GMT memory: Free 2 temporary column arrays, each of length : 2097152
Minimal Complete Verifiable Example
import pandas as pd
import pygmt
import numpy as np
import faulthandler
faulthandler.enable()

data = pd.DataFrame(
    data={
        "distance_along_line": np.linspace(0,10000,1000),
        "Free_air":np.linspace(100, 10000, 1000),
    },
)

print(pygmt.show_versions())

filtered = pygmt.filter1d(
    data[["distance_along_line", "Free_air"]],
    end=False,
    time_col=0,
    filter_type="g1000",
    verbose="debug",
)

print(filtered)
Full error message
pygmt-session [DEBUG]: Revised options: @GMTAPI@-S-I-D-V-T-N-000000 -Fg1000 -N0 -Vd ->@GMTAPI@-S-O-D-D-A-Y-000001
filter1d [DEBUG]: Look for file 1000 in /home/sungw937/.gmt
filter1d [DEBUG]: Look for file 1000 in /home/sungw937/.gmt/cache
filter1d [DEBUG]: Look for file 1000 in /home/sungw937/.gmt/server
filter1d [INFORMATION]: Processing input table data
filter1d [DEBUG]: gmtapi_init_import: Passed family = Data Table and geometry = Line
filter1d [DEBUG]: gmtapi_init_import: Added 1 new sources
filter1d [DEBUG]: GMT_Init_IO: Returned first Input object ID = 0
filter1d [DEBUG]: gmtapi_begin_io: Input resource access is now enabled [container]
filter1d [DEBUG]: gmtapi_import_dataset: Passed ID = -1 and mode = 0
filter1d [INFORMATION]: Referencing data table from user 2 column arrays of length 1000
filter1d [DEBUG]: Object ID 2 : Registered Data Table Memory Reference 55e628994960 as an Input resource with geometry Point [n_objects = 3]
filter1d [DEBUG]: gmtapi_import_dataset processed 1 resources
filter1d [DEBUG]: GMT_End_IO: Input resource access is now disabled
filter1d [DEBUG]: gmtapi_init_export: Passed family = Data Table and geometry = Line
filter1d [DEBUG]: gmtapi_init_export: Added 1 new destination
filter1d [DEBUG]: GMT_Init_IO: Returned first Output object ID = 1
filter1d [DEBUG]: GMT_Begin_IO: Mode value 1 not considered (ignored)
filter1d [DEBUG]: GMT_Begin_IO: Initialize record-by-record access for Output
filter1d [DEBUG]: gmtapi_next_io_source: Selected object 1
filter1d [INFORMATION]: Writing Data Table to memory copy supplied by pointer
filter1d [DEBUG]: GMT_Begin_IO: Output resource access is now enabled [record-by-record]
filter1d [DEBUG]: GMTAPI: GMT_Set_Geometry called but no object available
filter1d [INFORMATION]: Filter the data columns
filter1d [INFORMATION]: Read 1000 records from table 0, segment 0
filter1d [INFORMATION]: F width: 1000 Resolution: 10.01 Start: 500.501 Stop: 9499.5
filter1d [DEBUG]: GMTAPI: GMT_Put_Record (double) called before any segments declared
filter1d [DEBUG]: GMT memory: Initialize 2 temporary column double arrays, each of length : 0
filter1d [DEBUG]: Object ID 3 : Registered Data Table Memory Reference 55e628a8fd20 as an Output resource with geometry Point|Line|Poly [n_objects = 4]
filter1d [DEBUG]: GMT_End_IO: Output resource access is now disabled
filter1d [DEBUG]: gmtlib_garbage_collection: Destroying object: C=0 A=0 ID=2 W=Input F=Data Table M=Memory Reference S=Used P=55e628994960 N=(null)
filter1d [DEBUG]: GMTAPI_Garbage_Collection freed 1 memory objects
filter1d [DEBUG]: gmtlib_unregister_io: Unregistering object no 2 [n_objects = 3]
filter1d [DEBUG]: gmtlib_unregister_io: Unregistering object no 3 [n_objects = 2]
filter1d [DEBUG]: GMT memory: Free 2 temporary column arrays, each of length : 2097152
free(): invalid next size (fast)
Aborted (core dumped)
System information
PyGMT information:
  version: v0.18.0
System information:
  python: 3.14.3 | packaged by conda-forge | (main, Feb  9 2026, 21:56:02) [GCC 14.3.0]
  executable: /home/sungw937/miniforge3/envs/pygmt_mkl/bin/python
  machine: Linux-5.15.167.4-microsoft-standard-WSL2-x86_64-with-glibc2.39
Dependency information:
  numpy: 2.4.3
  pandas: 3.0.1
  xarray: 2026.2.0
  packaging: 26.0
  contextily: None
  geopandas: None
  IPython: None
  pyarrow: None
  rioxarray: None
  gdal: 3.12.3
  ghostscript: 10.06.0
GMT library information:
  version: 6.6.0
  padding: 2
  share dir: /home/sungw937/miniforge3/envs/pygmt_mkl/share/gmt
  plugin dir: /home/sungw937/miniforge3/envs/pygmt_mkl/lib/gmt/plugins
  library path: /home/sungw937/miniforge3/envs/pygmt_mkl/lib/libgmt.so
  cores: 8
  grid layout: rows
  image layout: 
  binary version: 6.6.0
Dominant language
Python
Stars
882
Forks
261
Avg merge
1d 3h
Merged PRs (30d)
29

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from GenericMappingTools/pygmt

All issues in GenericMappingTools/pygmt

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.