-
Notifications
You must be signed in to change notification settings - Fork 189
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
Visualizer and Collision detection glue_to_surface mode causes segmentation faults #4663
Comments
I'd guess (without having checked) that the visualizer doesn't take the change in particle number (or type) gracefully. |
Most likely undefined behavior: the segmentation fault doesn't happen when running the script inside of GDB, or without the visualizer, or with |
Spoke too soon: it also happens on non-empty vectors. The bug boils down to: #include <boost/mpi/collectives.hpp>
#include <boost/serialization/vector.hpp>
#include <vector>
int main() {
boost::mpi::environment env;
boost::mpi::communicator world;
for (long i = 0; i < 1000000; ++i) {
std::vector<int> test = {1};
boost::mpi::broadcast(world, test, 0); // fatal error
}
return 0;
} It is however not reproducible without the ESPResSo visualizer. Running the MWE doesn't trigger the bug: mpicxx mwe.cpp -lboost_mpi -lboost_serialization
mpiexec -n 1 ./a.out To make the investigation simpler, inject the MWE in ESPResSo with this patch: diff --git a/src/core/collision.cpp b/src/core/collision.cpp
index 41f47f6d7..e3564dba1 100644
--- a/src/core/collision.cpp
+++ b/src/core/collision.cpp
@@ -397,8 +397,8 @@ void glue_to_surface_bind_part_to_vs(const Particle *const p1,
std::vector<CollisionPair> gather_global_collision_queue() {
std::vector<CollisionPair> res = local_collision_queue;
- Utils::Mpi::gather_buffer(res, comm_cart);
- boost::mpi::broadcast(comm_cart, res, 0);
+ std::vector<int> test = {1};
+ boost::mpi::broadcast(comm_cart, test, 0);
return res;
} Several different fatal exception traces from an ASAN+UBSAN build using the injected MWE are reproduced below. Since the issue happens inside the Boost MPI code but isn't reproducible outside of ESPResSo, the Boost team cannot act on it. As a workaround, we can skip the fragile broadcast when the MPI world has size 1, which is the most common use case when running the visualizer. stack traces and sanitizer reports (click to unroll)
|
Closes #4663 Description of changes: - the `*_arrows_type_materials` options of the visualizer now have an effect on arrow materials - the visualizer `freeglut` dependency has been added to the user guide - issues with the exception handling mechanism have been addressed - undefined behavior in OpenMPI triggered by the visualizer (#4663) now has a workaround for simulations that use only 1 MPI rank
Closes espressomd#4663 Description of changes: - the `*_arrows_type_materials` options of the visualizer now have an effect on arrow materials - the visualizer `freeglut` dependency has been added to the user guide - issues with the exception handling mechanism have been addressed - undefined behavior in OpenMPI triggered by the visualizer (espressomd#4663) now has a workaround for simulations that use only 1 MPI rank
The collision detection mode "glue_to_surface" leads the visualizer to throw segmetation fault and other memory errors. This occurs random even if there is no collision happening.
The text was updated successfully, but these errors were encountered: