You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
grdfilter crashes in pygmt if GMT_IN is used #4577
However, if PyGMT uses GMT_IN, the above script crashes:
grdfilter [ERROR]: G->data is not NULL when memory allocation is about to happen
[Session pygmt-session (3)]: Error returned from GMT API: GMT_PTR_IS_NULL (75)
[Session pygmt-session (3)]: Error returned from GMT API: GMT_PTR_IS_NULL (75)
[Session pygmt-session (3)]: Error returned from GMT API: GMT_OBJECT_NOT_FOUND (60)
...
GMTCLibError: Failed to close virtual file '@GMTAPI@-S-I-G-M-G-N-000000'.
To reproduce the issue, please update your pygmt repository, checkout this PR (GenericMappingTools/pygmt#517), and run the above script.
It crashes with GMT 6.1.1 and GMT master, but it might work for old versions.
That I do PyGMT debugging (too) infrequently is perhaps good since it clearly points out lack of clear instructions on our debug page... These are the steps I took (I already had pygmt checked out from the repo before):
I pulled the latest to get all updates since last pull, then switched to the gmt-in branch.
I ran conda activate pygmt
I did export GMT_SHAREDIR=/Users/pwessel/GMTdev/gmt-dev/dbuild so that it points to a dir with share in it.
I already had GMT_LIBRARY_PATH set to point to the xcode-built library /Users/pwessel/GMTdev/gmt-dev/xbuild/src/Debug
I start python in the terminal
I attach Xcode to the python process
I set a stop point in GMT_Call_Module
I copy/paste the three lines in the script above, one by one.
It reproduces the crash but did not stop in Xcode. Am I missing a "build or install" type step for pyGMT above?
OK, I rebuilt but also selected target libgmt in Xcode and stop point in GMT_Call_Module. That is probably better since gmt.c is not involved.
GMT_Read_Data gets to the case GMT_IS_DUPLICATE|GMT_VIA_MATRIX and not GMT_IS_REFERENCE. So not sure where it switches since you said this branch passes GMT_IN.
Anyway, looks like we call GMT_Create_Data for the grid to allocate memory for data and then later complain taht data is allocated. Seems like a simple fix - will apply and check.
Activity
PaulWessel commentedon Dec 19, 2020
That I do PyGMT debugging (too) infrequently is perhaps good since it clearly points out lack of clear instructions on our debug page... These are the steps I took (I already had pygmt checked out from the repo before):
export GMT_SHAREDIR=/Users/pwessel/GMTdev/gmt-dev/dbuildso that it points to a dir with share in it.It reproduces the crash but did not stop in Xcode. Am I missing a "build or install" type step for pyGMT above?
seisman commentedon Dec 19, 2020
I don't see anything wrong.
PaulWessel commentedon Dec 19, 2020
OK, will rebuild the xcode debug and start from the top.
PaulWessel commentedon Dec 19, 2020
OK, I rebuilt but also selected target libgmt in Xcode and stop point in GMT_Call_Module. That is probably better since gmt.c is not involved.
GMT_Read_Data gets to the case GMT_IS_DUPLICATE|GMT_VIA_MATRIX and not GMT_IS_REFERENCE. So not sure where it switches since you said this branch passes GMT_IN.
Anyway, looks like we call GMT_Create_Data for the grid to allocate memory for data and then later complain taht data is allocated. Seems like a simple fix - will apply and check.
PaulWessel commentedon Dec 19, 2020
Hm, after passing mode = GMT_CONTAINER_ONLY to GMT_Create_Data for the grid, the grid still has a non-zero data pointer. OK, so need to go deeper.
Grid and cube containers allocated to hold matrices should not alloca…
Grid and cube containers allocated to hold matrices should not alloca…