MESAHub/mesa

segfault in pgbinary_orbit when secondary is a point mass

Closed this issue ยท 4 comments

Describe the bug
When using the "Orbit" panel in pgbinary, a segmentation fault occurs when the secondary is a point mass.

To Reproduce
Use the pgbinary inlist provided in evolve_both_stars in the test_suite.
Set
evolve_both_stars=.false.

For some machines, the calculation stops with a segmentation fault when the pgbinary module writes into a png file. So far we've reproduced this bug in two linux machines and it doesn't seem to occur in Mac. The Xwindows output seems to be fine. It only crashes when outputting to png.

The problem seems to be that x2s_RL and y2s_RL are both not set when the secondary is a point mass in subroutine orbitpanel in pgbinary_orbit.f90. As a workaround, both arrays can be set to 0 when the secondary is a point mass. This seems to generate the same output without segfaulting.

Thank you, Ryosuke, for your report.
I can reproduce the problem (on my Mac), and, as you suggested, there is an easy way to solve this issue. I will implement this for the next release.

It is quite curious however that a segfault only occurs when writing to a file, and not when displaying on the screen. Most likely there is an obscure reason for this that MESA cannot control.

@matthiasfabry are you on an intel mac? I was unable to reproduce this on my m1 machine.

-EbF

Yes I am, on mesa-r23.05.1, sdk version x86_64-macos-23.10.1

This has been solved, so I will close this issue now.