Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault with latest Rebound version when accessing orbit of a particle #744

Open
Anit5577 opened this issue Jan 17, 2024 · 5 comments
Labels

Comments

@Anit5577
Copy link

Environment
Which version of REBOUND are you using and on what operating system?

  • REBOUND Version: [4.0.3]
  • API interface: [Python]
  • Operating System (including version): [Linux]

Describe the bug
I have just updated to the latest REBOUND version and changed the names of different functions in my analysis script (e.g. SimulationArchive to Simulationarchive) to the new names. However, when I run my script, I now get a segmentation fault every time:

Fatal Python error: Segmentation fault

Main thread:
Current thread 0x00007f83901921c0 (most recent call first):
File "/home/cschoett/.local/lib/python3.10/site-packages/rebound/particle.py", line 460 in orbit
File "/home/cschoett/Documents/Kepler_dichotomy_rebound/Rebound_batch_analysis_full_incl.py", line 563 in <----
File "/home/cschoett/.local/lib/python3.10/site-packages/spyder_kernels/py3compat.py", line 356 in compat_exec
File "/home/cschoett/.local/lib/python3.10/site-packages/spyder_kernels/customize/spydercustomize.py", line 469 in exec_code
File "/home/cschoett/.local/lib/python3.10/site-packages/spyder_kernels/customize/spydercustomize.py", line 736 in _exec_cell
File "/home/cschoett/.local/lib/python3.10/site-packages/spyder_kernels/customize/spydercustomize.py", line 685 in runcell
File "/tmp/ipykernel_46322/1087412396.py", line 1 in <cell line: 1>

In the location above <---- in my own script, I use a hash to access the semi-major axis of a particle in my simulations. This segmentation fault does not occur at the same point in the script every time I run it. Sometimes, it occurs when I access the inclination of a different planet. The other script references are the same, though. This worked find in the past after updating REBOUND and has now failed.

sim_list[n][x].particles[h(5)].orbit(primary=sim_list[n][x].particles[centre_star]).a

np.degrees(sim_list[n][x].particles[h(4)].orbit(primary=sim_list[n][x].particles[centre_star]).inc)

@Anit5577 Anit5577 added the bug label Jan 17, 2024
@hannorein
Copy link
Owner

This is hard to debug without seeing more of your code (ideally something short I can run myself to reproduce the issue). From what I see here, it looks like the particle for which you calculate the orbit has an invalid pointer to a simulation it is supposed to be in (each particle has a pointer so it knows in which simulation it is in). So maybe you deallocated a simulation at some point by accident?

@Anit5577
Copy link
Author

Just putting something together for you to reproduce this issue. In the meantime, I downgraded my Rebound version to 3.26.0, where this is not happening when analysing my data. Anything more recent than that causes a segmentation fault.

@Anit5577
Copy link
Author

It seems that the issue I am having is connected with analysing simulations set up/run with an older version Rebound (e.g. 3.26.0) when my analysis code runs in the latest version. I now have a few simulations that are created and run in the latest version 4.3.1 and I no longer experience a segmentation fault when being analysed while running the latest version.

@hannorein
Copy link
Owner

In principle SimulationArchives should be compatible across different versions. But I would recommend to save/load simulations with the same version. I just can't test all possible combinations.

@Anit5577
Copy link
Author

Completely agree, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants