Bug #870

grdcontour crashes repeatedly on a surface where there are no contours to be drawn v 5.2.1

Added by Hemant about 1 year ago. Updated about 1 year ago.

Status:ClosedStart date:2016-03-09
Priority:NormalDue date:
Assignee:Paul% Done:

100%

Category:-
Target version:Candidate for next bugfix release
Affected version:5.2-svn Platform:

Description

Hi,
I am repeatedly getting crash from grdcontour for this particular surface(nc file). (Its middle of an ocean).
grdcontour has run successfully on several other cases. Its compiled on ubuntu 14.04 from downloaded zip source code for 5.2.1 from your website.
The crash goes away if I request a contour that I know would exist. I am looking at a workaround.
I am pasting a sample run below.

$gmt grdcontour mysurface.nc -Jm1:45000 -Ccontour_intervals.txt -S4 --FORMAT_FLOAT_OUT=%.12lg -P -Ba -Dmydata.txt
ERROR: Caught signal number 11 (Segmentation fault) at
/usr/local/lib/x86_64-linux-gnu/libgmt.so.5(GMT_write_table+0x693)[0x7f7f10561aa3]
[0x0]
Stack backtrace:
/usr/local/lib/x86_64-linux-gnu/libgmt.so.5(sig_handler+0x13f)[0x7f7f10515d8f]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340)[0x7f7f102b7340]
/usr/local/lib/x86_64-linux-gnu/libgmt.so.5(GMT_write_table+0x693)[0x7f7f10561aa3]
/usr/local/lib/x86_64-linux-gnu/libgmt.so.5(GMT_write_dataset+0x3a5)[0x7f7f10565585]
/usr/local/lib/x86_64-linux-gnu/libgmt.so.5(GMTAPI_Export_Dataset+0x270)[0x7f7f105257f0]
/usr/local/lib/x86_64-linux-gnu/libgmt.so.5(GMTAPI_Export_Data+0x15d)[0x7f7f105260dd]
/usr/local/lib/x86_64-linux-gnu/libgmt.so.5(GMT_Put_Data+0x74)[0x7f7f10526174]
/usr/local/lib/x86_64-linux-gnu/libgmt.so.5(GMT_Write_Data+0x114)[0x7f7f10526314]
/usr/local/lib/x86_64-linux-gnu/libgmt.so.5(GMT_grdcontour+0x29e1)[0x7f7f10747611]
/usr/local/lib/x86_64-linux-gnu/libgmt.so.5(GMT_Call_Module+0xc0)[0x7f7f1051a530]
gmt(main+0x62b)[0x40129b]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7f7f0ff03ec5]
gmt[0x401578]
$
$# insert a known contour that should exist.
$diff contour_intervals.txt contour_intervals_nocrash.txt
22a23

4850 C

$
$gmt grdcontour mysurface.nc -Jm1:45000 -Ccontour_intervals_nocrash.txt -S4 --FORMAT_FLOAT_OUT=%.12lg -P -Ba -Dmydata.txt
$head mydata.txt

4850 contour -Z4850

-7.34285994239 45.573289756 4850
-7.34281653584 45.5734237154 4850
-7.34280203046 45.5734767781 4850
-7.34278110312 45.5735599624 4850
-7.34274824333 45.5736968546 4850
-7.34271724266 45.5738341636 4850
-7.34268810238 45.5739718897 4850
-7.34267768669 45.5740234839 4850
-7.34266100923 45.5741100528 4850
$

mysurface.nc (1.26 MB) Hemant, 2016-03-09 09:36

contour_intervals.txt Magnifier (162 Bytes) Hemant, 2016-03-09 09:36

contour_intervals_nocrash.txt Magnifier (169 Bytes) Hemant, 2016-03-09 09:36

mysurface.nc (1.26 MB) Hemant, 2016-03-09 09:36

gmt.history (79 Bytes) Hemant, 2016-03-09 09:37

History

#1 Updated by Joaquim about 1 year ago

  • Status changed from New to In Progress

Can confirm this is an issue on trunk too.

#2 Updated by Paul about 1 year ago

  • Status changed from In Progress to Resolved
  • Assignee set to Paul
  • Target version set to Candidate for next bugfix release
  • % Done changed from 0 to 100

Should be fixed in r15864.

#3 Updated by Hemant about 1 year ago

Paul,Thanks for quick fix. Could you please clarify if the bug happens only in the case of no contours.

I am trying to figure out if I can wait to include this fix.(The file has changed significantly since 5.2.1 snapshot so I am not able to apply the patch). I am not sure how stable the trunk usually is. (Probably should ask this in forum instead...)

HB

#4 Updated by Joaquim about 1 year ago

Hemant, Paul's fix is for the case of no contours (which, I think, is the only case your bug shows up). You can safely apply it to your 5.2.1 source code.
Regarding trunk, it's normally quite stable though we may occasionally break but normally we find and fix it right away.

#5 Updated by Paul about 1 year ago

  • Status changed from Resolved to Closed

Closing this as fixed.

Also available in: Atom PDF