openmc icon indicating copy to clipboard operation
openmc copied to clipboard

OpenMP thread aborting can cause segfault?

Open paulromano opened this issue 2 years ago • 0 comments

A user recently reported that they were seeing a segfault. After following up, it was determined that they have some geometry errors and particles are being lost. As best as I can tell, the sequence of events that leads to a segfault is:

  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, 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

Running the same problem with a single thread does not result in a segfault. This would indicate we need a better way to tear down the program when an OpenMP thread reaches a fatal error.

paulromano avatar Apr 29 '22 20:04 paulromano