Bug #968
-JPr malloc crash on OSX w/ grdcontour and on Linux w/ grdimage
Status: | Closed | Start date: | 2016-09-21 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | % Done: | 100% | ||
Category: | - | |||
Target version: | Candidate for next bugfix release | |||
Affected version: | 5.2-svn | Platform: | Mac OS X |
Description
Dear GMT team,
referring to the entry in the gmt-user forum (where the full script and data are to find)
[[http://gmt.soest.hawaii.edu/boards/1/topics/4103]]
I file a bug issue for grdcontour and the polar projection (-JP). The nasty command line
gmt grdcontour brdf_14/01_brdf.ring.755.00.ps.dat.nc -JP6ir -Xa2c -Ya4c -By30 -Bx30 -Cbrdf_14/01_brdf.ring.755.00.ps.dat.cpt -A- -W+1p -V -K -O >> brdf_14/01_brdf.ring.755.00.ps.dat.ps
crashes on a Intel Mac OSX 10.11.6 (15G31) with GMT 5.2.1 (r15220) (via MacPorts) with
grdcontour: Processing input grid grdcontour: Allocate memory and read data file gmt(48322,0x7fff772a9000) malloc: *** error for object 0x7ff831059608: incorrect checksum for freed object - object was probably modified after being freed. *** set a breakpoint in malloc_error_break to debug ./do-gmt.sh: line 62: 48322 Abort trap: 6 gmt grdcontour $NC ${PROJ} $OFF $AXy $AXx $FORMAT -C$COL -A- $CONT -V -K -O >> $PLOT ERROR: Caught signal number 11 (Segmentation fault) at 0 libsystem_malloc.dylib 0x00007fff9158beec small_malloc_from_free_list + 584 1 ??? 0x0000000000000000 0x0 + 0 Stack backtrace: 0 libgmt.5.dylib 0x000000010c6eecd2 sig_handler + 338 1 libsystem_platform.dylib 0x00007fff987a252a _sigtramp + 26 2 ??? 0x00007fff5351ca20 0x0 + 140734591257120 3 libsystem_malloc.dylib 0x00007fff91588b64 szone_malloc_should_clear + 1411 4 libsystem_malloc.dylib 0x00007fff9158b9a6 malloc_zone_calloc + 78 5 libsystem_malloc.dylib 0x00007fff9158c462 calloc + 49 6 libpostscriptlight.5.dylib 0x0000000110e6a2f2 PSL_plotline + 66 7 libpostscriptlight.5.dylib 0x0000000110e6a212 PSL_beginclipping + 98 8 libgmt.5.dylib 0x000000010c810b2c GMT_map_clip_on + 172 9 libgmt.5.dylib 0x000000010c93da55 GMT_grdcontour + 9013 10 libgmt.5.dylib 0x000000010c70346c GMT_Call_Module + 284 11 gmt 0x000000010c6e6307 main + 1159 12 libdyld.dylib 0x00007fff911765ad start + 1 13 ??? 0x000000000000000c 0x0 + 12
Consistently but more interestingly the almost same behaviour with the same script is obtained on a Linux installation with the combination of
Linux 3.13.0-86-generic #131-Ubuntu x86_64 GNU/Linux
gmt --version 5.1.2 (r14084)
but now the script crashes already with grdimage as
grdimage: Allocates memory and read data file *** Error in `gmt': malloc(): memory corruption: 0x0000000001f8dc30 *** ./do-gmt.sh: line 87: 14867 Aborted (core dumped) gmt grdimage $NC $PROJ $OFF -C$COL -K -V > $PLOT gmt grdcontour brdf_14/brdf.ring.758.00.ps.dat.nc -JP15.24cr -Xa2c -Ya4c -By30 -Bx30 -Cbrdf_14/brdf.ring.758.00.ps.dat.cpt -A- -W+1p -V -K -O >> brdf_14/brdf.ring.758.00.ps.dat.ps *** Error in `gmt': malloc(): memory corruption: 0x0000000001d81940 *** ./do-gmt.sh: line 93: 14869 Aborted (core dumped) gmt grdcontour $NC ${PROJ} $OFF $AXy $AXx $FORMAT -C$COL -A- $CONT -K -O >> $PLOT *** Error in `gmt': malloc(): memory corruption: 0x0000000000af2ce0 *** ./do-gmt.sh: line 96: 14871 Aborted (core dumped) gmt grdcontour $ANGLENC $PROJ $OFF -Gd5c -C10 $CONTb -A20+f22.5+u'\260' -K -O >> $PLOT
Regards
History
#1
Updated by Joaquim over 4 years ago
Luca, the problem is that with this information we are not able to try to reproduce the issue. We also need the input data (or a small subset that allows to reproduce the problem).
#2
Updated by Luca over 4 years ago
- File test.dat.correct.png added
- File do-gmt-polar.sh
added
- File test.dat.wrong.png added
- File test.dat added
Joaquim wrote:
Luca, the problem is that with this information we are not able to try to reproduce the issue.
We also need the input data (or a small subset that allows to reproduce the problem).
Hello Joaquim, thanks for the reply.
I'm attaching 4 files: the script, the test data, the correct output plot (obtained with -JP6i) and the wrong output plot (with -JP6ir).
This happens for the Intel Mac OSX 10.11.6 (15G31) with GMT 5.2.1 (r15220) (via MacPorts).
The error message reads:
grdcontour: Processing input grid grdcontour: Allocate memory and read data file gmt(15967,0x7fff7bf76000) malloc: *** error for object 0x7fae84865a08: incorrect checksum for freed object - object was probably modified after being freed. *** set a breakpoint in malloc_error_break to debug ./do-gmt-polar.sh: line 39: 15967 Abort trap: 6 gmt grdcontour $NC ${PROJ} $OFF $AXy $AXx $FORMAT -C$COL -A- $CONT -V -K -O >> $PLOT
Hope you can reproduce the behaviour.
Regards.
#3
Updated by Joaquim over 4 years ago
- Status changed from New to Resolved
Well, nope. Cannot reproduce. It works fine here, but I'm using the developing version. So hopefully this was already solved.
#4
Updated by Joaquim over 4 years ago
- Status changed from Resolved to In Progress
Correction, yes I can reproduce it. It's that I just run your script and that worked but if I add the 'r' to the projection than it crashes.
#5
Updated by Luca over 4 years ago
- File test.dat.linux.wrong.png added
Joaquim wrote:
Correction, yes I can reproduce it. It's that I just run your script and that worked but if I add the 'r' to the projection than it crashes.
Thanks Joaquim.
If it may help, I was experimenting with the development subversion ( 5.3.0_r17114 ) on the Linux box instead, and I get the same error message
grdimage: Allocates memory and read data file *** Error in `gmt': malloc(): memory corruption: 0x0000000000853770 *** ./do-gmt-polar.sh: line 35: 2011 Aborted (core dumped) gmt grdimage $NC $PROJ $OFF -C$COL -V -K > $PLOT grdcontour: Processing input grid grdcontour: Allocate memory and read data file *** Error in `gmt': malloc(): memory corruption: 0x00000000025fbd60 *** ./do-gmt-polar.sh: line 39: 2013 Aborted (core dumped) gmt grdcontour $NC ${PROJ} $OFF $AXy $AXx $FORMAT -C$COL -A- $CONT -V -K -O >> $PLOT
but now with a different wrong output plot (attached).
Regards
#6
Updated by Joaquim over 4 years ago
I can easily find where it crashes but this one those non obvious bugs as the Visual Studio diagnosis says "A heap memory was corrupted", which means the source of the error is not at the place where it crashes.
#7
Updated by Paul over 4 years ago
- Status changed from In Progress to Resolved
- Assignee set to Paul
We had an allocation problem where one test said we needed N points and then the calculation needed 2*N points. Should be fixed in r17145 - let us know. We added a couple of tests to the test suite inspired by your script and they pass.
#8
Updated by Paul over 4 years ago
- Status changed from Resolved to Closed
- Target version set to Candidate for next bugfix release
- % Done changed from 0 to 100
Also fixed in GMT 4 (r10364). Seems to work well; closing this issue.
#9
Updated by Luca over 4 years ago
Paul wrote:
Also fixed in GMT 4 (r10364). Seems to work well; closing this issue.
Hello Paul,
apologies for the late reply. I tested it and it seems to me it does the job.
Thanks again for this.