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
Figure.solar crashes on Linux when drawing nautical terminator for 2024-04-16T06:00:00 #2959
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines and code of conduct.
For me, it fails under Linux as reported, but it works under Windows.
Output of verbose="d":
solar [DEBUG]: Map distance calculation will be using great circle approximation with authalic auxiliary latitudes and authalic (R_2) radius = 6371007.1809 m, in meter.
solar [DEBUG]: Map distance calculation will be using great circle approximation with authalic auxiliary latitudes and authalic (R_2) radius = 6371007.1809 m, in meter.
solar [DEBUG]: Reset MAP_ANNOT_OBLIQUE to anywhere
solar [DEBUG]: Projected values in meters: -1.80199e+07 1.80199e+07 -9.00996e+06 9.00996e+06
solar [DEBUG]: Computed automatic parameters using dimension scaling: 0.908088
solar [INFORMATION]: Map scale is 2402.66 km per cm or 1:2.40266e+08.
solar [DEBUG]: Running in PS mode modern
solar [DEBUG]: Use PS filename /home/yfroe/.gmt/sessions/gmt_session.28939/gmt_4.ps-
solar [DEBUG]: Append to hidden PS file /home/yfroe/.gmt/sessions/gmt_session.28939/gmt_4.ps-
solar [DEBUG]: Got session name as pygmt-session and default graphics formats as pdf
solar [DEBUG]: Basemap order: Frame = above Grid = above Tick/Annot = above
solar [DEBUG]: gmt_get_smallcircle: Added extra point at 0/-90.9771
solar [DEBUG]: gmt_get_smallcircle: Added extra point at 0/-89.0292
solar [DEBUG]: gmtlib_determine_pole: N = 363 Multiples of 360: 0 Residual: -4.54747e-13 Polygon contains south (CW) pole.
solar [INFORMATION]: Plot small circle with pole at 89.9773/10.0419 and radius 102 degrees
solar [DEBUG]: Polar cap: 1
solar [DEBUG]: Try to include S pole in polar cap path
solar [DEBUG]: West longitude = -180. East longitude = 180
solar [DEBUG]: gmtlib_determine_pole: N = 363 Multiples of 360: 0 Residual: -4.54747e-13 Polygon contains south (CW) pole.
solar [DEBUG]: First longitude = 89.9773. Last longitude = 89.9773
solar [DEBUG]: Crossing at -180,-90
solar [DEBUG]: k at point closest to lon -180 is = 0 [n = 363]
solar [DEBUG]: Created path from 180/-90 to 180/-90 [0 points]
solar [DEBUG]: Add perimeter data from k0->n [0->363], then 0->k0 [0]
solar [DEBUG]: Add path from -180/-90 to -180/-90 [0 points]
solar [DEBUG]: New path has 364 points, we allocated 363 points
malloc(): invalid size (unsorted)
Fatal Python error: Aborted
It looks like the issue is related to the fill parameter. If specifying a fill color via fill the code fails, but it works if not using fill or fill=None [Default]. The "problematic" date part seems to be hour=6, minute=0.
importdatetimeimportpygmtterm_datetime=datetime.datetime(
year=2024,
month=4,
day=16,
hour=6,
minute=0, # fails with a fill color# minute=1, # works with a fill colorsecond=0,
)
print(term_datetime)
fig=pygmt.Figure()
fig.coast(region="d", projection="W10c", shorelines=True, frame=True)
fig.solar(
terminator="nautical",
terminator_datetime=term_datetime,
# fill=None, # worksfill="blue", # fails# pen="1p,red,solid", # works
)
fig.show()
solar [DEBUG]: Map distance calculation will be using great circle approximation with authalic auxiliary latitudes and authalic (R_2) radius = 6371007.1809 m, in meter.
solar [DEBUG]: Map distance calculation will be using great circle approximation with authalic auxiliary latitudes and authalic (R_2) radius = 6371007.1809 m, in meter.
solar [DEBUG]: Reset MAP_ANNOT_OBLIQUE to anywhere
solar [DEBUG]: Projected values in meters: -1.80199e+07 1.80199e+07 -9.00996e+06 9.00996e+06
solar [DEBUG]: Computed automatic parameters using dimension scaling: 0.908088
solar [INFORMATION]: Map scale is 2402.66 km per cm or 1:2.40266e+08.
solar [DEBUG]: Running in PS mode modern
solar [DEBUG]: Use PS filename /home/{my_user_name}/.gmt/sessions/gmt_session.852013/gmt_1.ps-
solar [DEBUG]: Append to hidden PS file /home/{my_user_name}/.gmt/sessions/gmt_session.852013/gmt_1.ps-
solar [DEBUG]: Got session name as pygmt-session and default graphics formats as pdf
solar [DEBUG]: Basemap order: Frame = above Grid = above Tick/Annot = above
solar [DEBUG]: gmt_get_smallcircle: Added extra point at 0/-90.9758
solar [DEBUG]: gmt_get_smallcircle: Added extra point at 0/-89.0332
solar [DEBUG]: gmtlib_determine_pole: N = 363 Multiples of 360: 0 Residual: -1.27898e-13 Polygon contains south (CW) pole.
solar [INFORMATION]: Plot small circle with pole at 89.9329/10.3111 and radius 102 degrees
solar [DEBUG]: Polar cap: 1
solar [DEBUG]: Try to include S pole in polar cap path
solar [DEBUG]: West longitude = -180. East longitude = 180
solar [DEBUG]: gmtlib_determine_pole: N = 363 Multiples of 360: 0 Residual: -1.27898e-13 Polygon contains south (CW) pole.
solar [DEBUG]: First longitude = 89.9329. Last longitude = 89.9329
solar [DEBUG]: Crossing at -180,-90
solar [DEBUG]: k at point closest to lon -180 is = 0 [n = 363]
solar [DEBUG]: Created path from 180/-90 to 180/-90 [0 points]
solar [DEBUG]: Add perimeter data from k0->n [0->363], then 0->k0 [0]
solar [DEBUG]: Add path from -180/-90 to -180/-90 [0 points]
solar [DEBUG]: New path has 364 points, we allocated 363 points
malloc(): invalid size (unsorted)
Aborted (core dumped)
Output of
gmt solar -Rd -JW10c -Baf -Tn+d2024-04-16T06:00:00 -Gblue -png map
changed the title [-]Crash when draw nautical terminator for year=2024, month=4, day=16, hour=6, minute=0, second=0[/-][+]Figure.solar crashes on Linux when drawing nautical terminator for 2024-04-16T06:00:00[/+]on Jan 6, 2024
Thanks @PaulWessel for immediately looking at this. So far, this issue appears to be OS-dependent: it works on Windows and macOS, but it fails on Linux.
So it SEGVs in line 565? That is a calloc call but the message says malloc? What are the values of Belem and size? The message about size is invalid (unsorted) is strange was size is a scalar, no??
solar [DEBUG]: New path has 364 points, we allocated 363 points
As the OP says, using a slightly different time works:
$ gmt solar -Rd -JW10c -Tn+d2024-04-16T06:01:00 -Gblue -png map
solar [DEBUG]: gmt_get_smallcircle: Added extra point at 180/-86.5149
solar [DEBUG]: gmt_get_smallcircle: Added extra point at 0/-89.0502
solar [DEBUG]: gmtlib_determine_pole: N = 363 Multiples of 360: 1 Residual: 2.27374e-13 Polygon contains south (CCW) pole.
solar [INFORMATION]: Plot small circle with pole at 89.6829/10.3113 and radius 102 degrees
solar [DEBUG]: Polar cap: 1
solar [DEBUG]: Try to include S pole in polar cap path
solar [DEBUG]: West longitude = -180. East longitude = 180
solar [DEBUG]: gmtlib_determine_pole: N = 363 Multiples of 360: 1 Residual: 2.27374e-13 Polygon contains south (CCW) pole.
solar [DEBUG]: Make polygon to clockwise
solar [DEBUG]: First longitude = 89.6829. Last longitude = 89.6829
solar [DEBUG]: Crossing at -180,-86.5149
solar [DEBUG]: k at point closest to lon -180 is = 358 [n = 363]
solar [DEBUG]: Created path from 180/-90 to 180/-86.5149 [48 points]
solar [DEBUG]: Add perimeter data from k0->n [358->363], then 0->k0 [358]
solar [DEBUG]: Add path from -180/-86.5149 to -180/-90 [48 points]
solar [DEBUG]: New path has 459 points, we allocated 459 points
Activity
welcome commentedon Jan 6, 2024
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. You might also want to take a look at our contributing guidelines and code of conduct.
seisman commentedon Jan 6, 2024
It works well for me, but I'm using macOS. Could you please add
verbose="d"to theFigure.solarmethod and post the debugging messages?yvonnefroehlich commentedon Jan 6, 2024
For me, it fails under Linux as reported, but it works under Windows.
Output of
verbose="d":yvonnefroehlich commentedon Jan 6, 2024
It looks like the issue is related to the
fillparameter. If specifying a fill color viafillthe code fails, but it works if not usingfillorfill=None[Default]. The "problematic" date part seems to behour=6, minute=0.seisman commentedon Jan 6, 2024
The equivalent GMT CLI is:
Could you please try if it fails for you on Linux?
yvonnefroehlich commentedon Jan 6, 2024
Yes, it fails with GMT 6.4 and 6.4.0_965606f_2022.03.14 on Linux.
astro-jingtao commentedon Jan 6, 2024
Output of
verbose="d":Output of
malloc(): invalid size (unsorted) Aborted (core dumped)[-]Crash when draw nautical terminator for year=2024, month=4, day=16, hour=6, minute=0, second=0[/-][+]Figure.solar crashes on Linux when drawing nautical terminator for 2024-04-16T06:00:00[/+]seisman commentedon Jan 6, 2024
It's likely an upstream bug, although I can't test if it has been fixed in the upcoming GMT 6.5.0 release.
Ping @PaulWessel.
PaulWessel commentedon Jan 6, 2024
6.5 master (i.e., release) on macOS arm64:
gmt solar -Rd -JW10c -Baf -Tn+d2024-04-16T06:00:00 -Gblue -png mapyvonnefroehlich commentedon Jan 6, 2024
Thanks @PaulWessel for immediately looking at this. So far, this issue appears to be OS-dependent: it works on Windows and macOS, but it fails on Linux.
PaulWessel commentedon Jan 6, 2024
So we need someone with Linux to run that command in ddd for example and learn what the crash is and why.
seisman commentedon Jan 7, 2024
It still crashes with GMT master branch. Trying to debug it, and this is the callstack and shows where it crashes:

PaulWessel commentedon Jan 7, 2024
So it SEGVs in line 565? That is a calloc call but the message says malloc? What are the values of Belem and size? The message about size is invalid (unsorted) is strange was size is a scalar, no??
seisman commentedon Jan 7, 2024
nelem=2048 and size=8.
seisman commentedon Jan 7, 2024
Does this debug message make sense to you?
As the OP says, using a slightly different time works:
PaulWessel commentedon Jan 7, 2024
Could you try on Linux to change line 9707 in gmt_plot.c to be
since perim_n is 0 this is a bit suspect. Does that help?
PaulWessel commentedon Jan 7, 2024
Sorry, MAX of course
seisman commentedon Jan 7, 2024
Yes,
n_new = 2 * MAX (1, perim_n) + n;works.Ensure allocated path is long enough for pssolar
Ensure allocated path is long enough for pssolar (#8261)
seisman commentedon Jan 7, 2024
The upstream bug has been fixed in the GMT's master branch and the working version GMT 6.5.0 will be released soon.