mesa icon indicating copy to clipboard operation
mesa copied to clipboard

segfault in pgbinary_orbit when secondary is a point mass

Open ryosuke-hirai opened this issue 11 months ago • 3 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.

ryosuke-hirai avatar Mar 20 '24 13:03 ryosuke-hirai

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 avatar Mar 20 '24 15:03 matthiasfabry

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

-EbF

Debraheem avatar Mar 20 '24 18:03 Debraheem

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

matthiasfabry avatar Mar 21 '24 11:03 matthiasfabry

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

Debraheem avatar May 14 '24 00:05 Debraheem