# RuntimeError: OpenMC aborted unexpectedly

**URL:** <https://openmc.discourse.group/t/runtimeerror-openmc-aborted-unexpectedly/1954>\
**Category:** User Support\
**Created:** [April 20, 2022, 1:48pm UTC](https://openmc.discourse.group/t/runtimeerror-openmc-aborted-unexpectedly/1954 "2022-04-20T13:48:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fahima](https://avatars.discourse-cdn.com/v4/letter/f/54ee81/32.png) [@Fahima](https://openmc.discourse.group/u/Fahima)\
**Post date:** [April 20, 2022, 1:48pm UTC](https://openmc.discourse.group/t/runtimeerror-openmc-aborted-unexpectedly/1954/1 "2022-04-20T13:48:48Z")

</div>

I was running the following code:

%matplotlib notebook  
import openmc

%env OPENMC\_CROSS\_SECTIONS /home/3fi/mcnp\_introductor/mcnp\_endfb70/cross\_sections.xml

geometry = openmc.Geometry.from\_xml(’/home/3fi/mcnp\_introductor/openmc/geometry.xml’)

geom = openmc.Geometry(geometry.root\_universe)

point = openmc.stats.Point((0, 0, 500))  
source = openmc.Source(space=point)

settings = openmc.Settings()  
settings.source = source  
settings.particles = 1000  
settings.run\_mode = ‘fixed source’  
settings.batches = 1

openmc.run()

And I got this error:

 ![error](https://global.discourse-cdn.com/free1/uploads/openmc/original/2X/0/07e9818d358a666c6b03516d17c06b1fced1d3ef.png)

Can anyone please help me to understand why it has this error?

---

<div class="post-metadata">

**Author:** ![pshriwise](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/pshriwise/32/3863_2.png) [@pshriwise](https://openmc.discourse.group/u/pshriwise)\
**Post date:** [April 20, 2022, 2:45pm UTC](https://openmc.discourse.group/t/runtimeerror-openmc-aborted-unexpectedly/1954/2 "2022-04-20T14:45:58Z")

</div>

Hi @Fahima,

There are a number of things could be happening here. From the output, it’s hard to say.

One thing that might help is to run the `openmc` executable from the command line instead of the Python interpreter. Useful information to help debug can sometimes be filtered out of the Python output. Increasing the [verbosity setting](https://docs.openmc.org/en/stable/io_formats/settings.html#verbosity-element) of the run might provide more information as well.

-Patrick

---

<div class="post-metadata">

**Author:** ![Fahima](https://avatars.discourse-cdn.com/v4/letter/f/54ee81/32.png) [@Fahima](https://openmc.discourse.group/u/Fahima)\
**Post date:** [April 20, 2022, 11:03pm UTC](https://openmc.discourse.group/t/runtimeerror-openmc-aborted-unexpectedly/1954/3 "2022-04-20T23:03:11Z")

</div>

Hi @pshriwise ,  
I was running with verbosity 10 and in CLI with this command: $ openmc -s 1 -g

It shows segmentation fault as shown below:

 ![error](https://global.discourse-cdn.com/free1/uploads/openmc/original/2X/b/b93c17802971a405e436d09ea0af85e25dcd366d.png)

Any idea what is wrong here?

---

<div class="post-metadata">

**Author:** ![pshriwise](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/pshriwise/32/3863_2.png) [@pshriwise](https://openmc.discourse.group/u/pshriwise)\
**Post date:** [April 21, 2022, 1:41am UTC](https://openmc.discourse.group/t/runtimeerror-openmc-aborted-unexpectedly/1954/4 "2022-04-21T01:41:05Z")

</div>

I’m honestly not sure. I was expecting more of an indication as to what was going wrong. Is there any chance you can share this model so I can dig into it further?

---

<div class="post-metadata">

**Author:** ![Fahima](https://avatars.discourse-cdn.com/v4/letter/f/54ee81/32.png) [@Fahima](https://openmc.discourse.group/u/Fahima)\
**Post date:** [April 21, 2022, 11:30am UTC](https://openmc.discourse.group/t/runtimeerror-openmc-aborted-unexpectedly/1954/5 "2022-04-21T11:30:59Z")

</div>

@pshriwise Here are the files. I converted the mcnp geometry to opnmc format. I am using the void geometry for now just to track the particles. For cross section I am using ENDF/B-VII.0 from [LANL-Based Data Libraries | OpenMC](https://openmc.org/lanl-data-libraries/)  
[geometry.xml](https://openmc.discourse.group/uploads/short-url/l6IqrlPz7Lkt2Kei0sfvWuQsJuT.xml) (617.1 KB)  
[materials.xml](https://openmc.discourse.group/uploads/short-url/fDLv4NTj5Ppqt3cyVhAbHBDLn24.xml) (20.4 KB)  
[settings.xml](https://openmc.discourse.group/uploads/short-url/qcYaxoVJ9ItWZtINT5gcuhAtymy.xml) (294 Bytes)

I would really appreciate your help

---

<div class="post-metadata">

**Author:** ![paulromano](https://yyz2.discourse-cdn.com/free1/user_avatar/openmc.discourse.group/paulromano/32/486_2.png) [@paulromano](https://openmc.discourse.group/u/paulromano)\
**Post date:** [April 29, 2022, 8:04pm UTC](https://openmc.discourse.group/t/runtimeerror-openmc-aborted-unexpectedly/1954/6 "2022-04-29T20:04:04Z")

</div>

@Fahima I’m not 100% sure why the segfault is happening, but I think it may be the following sequence of events:

1. Particles are being lost as they are transported
2. The lost particle limit is hit on one OpenMP thread, which proceeds to call `fatal_error` in the program, which calls `std::exit`
3. The call to `std::exit` starts tearing down memory
4. Meanwhile, other OpenMP threads are still trying to execute and eventually hit some piece of memory that no longer exists, causing a segfault.

If you run with a single thread (`openmc -s 1`), you don’t get a segfault but you’ll see a bunch of errors about lost particles. I would recommend following the advice given in our documentation about how to [diagnose geometry errors](https://docs.openmc.org/en/latest/usersguide/troubleshoot.html#warning-after-particle-crossed-surface-it-could-not-be-located-in-any-cell-and-it-did-not-leak).

---

<div class="post-metadata">

**Author:** ![Fahima](https://avatars.discourse-cdn.com/v4/letter/f/54ee81/32.png) [@Fahima](https://openmc.discourse.group/u/Fahima)\
**Post date:** [May 10, 2022, 3:16pm UTC](https://openmc.discourse.group/t/runtimeerror-openmc-aborted-unexpectedly/1954/7 "2022-05-10T15:16:59Z")

</div>

@paulromano I was trying to debug with only one thread. When I was trying with 1E4 particles it run successfully. However, when I run it with 1E5 it shows segment fault after a while. It just show segment fault even though I was running with the command `openmc -s 1`. I am again attaching all of my files here if you can help with anything I would really appreciate.  
[geometry.xml](https://openmc.discourse.group/uploads/short-url/wfW34VwvsW38OlTKtj8OZGqGOJ0.xml) (618.8 KB)  
[materials.xml](https://openmc.discourse.group/uploads/short-url/fDLv4NTj5Ppqt3cyVhAbHBDLn24.xml) (20.4 KB)  
[settings.xml](https://openmc.discourse.group/uploads/short-url/I67yOjAlRrHuH8hZCEcCefnPOy.xml) (327 Bytes)
