Skip to content

Commit

Permalink
fix: remove incorrect compile flags
Browse files Browse the repository at this point in the history
Those led to spurious aborts on insert, when exceptions were thrown in
a callback run in a worker thread via tbb. To reproduce easily, apply
the following change:

    diff --git a/src/silo/preprocessing/preprocessor.cpp b/src/silo/preprocessing/preprocessor.cpp
    index 92642ca9..7fe6996d 100644
    --- a/src/silo/preprocessing/preprocessor.cpp
    +++ b/src/silo/preprocessing/preprocessor.cpp
    @@ -62,6 +62,9 @@ Preprocessor::Preprocessor(
     }

     Database Preprocessor::preprocess() {
    +   tbb::parallel_for(tbb::blocked_range(0, 1), [](const auto i){
    +      throw std::runtime_error("");
    +   });
        SPDLOG_INFO(
           "preprocessing - creating intermediate results directory '{}'",
           preprocessing_config.getIntermediateResultsDirectory().string()

then build for linux with --release and run the preprocessing.

This will be the relevant information of the `gcc` manpage:

    There are several situations in which an application should
    use the shared libgcc instead of the static version.  The
    most common of these is when the application wishes to throw
    and catch exceptions across different shared libraries.  In
    that case, each of the libraries as well as the application
    itself should use the shared libgcc.

We violated that, due to tbb being linked dynamically, which led to
libgcc also being linked dynamically, while we already linked libgcc
statically to the other code.
  • Loading branch information
Taepper committed Jun 7, 2024
1 parent c7028cc commit b92ee4e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")

set(CMAKE_CXX_FLAGS "-Wall")
set(CMAKE_CXX_FLAGS_DEBUG "-g -fsanitize=address")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -static-libstdc++ -static-libgcc")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")

# Work-around only for MacOS
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
Expand Down

0 comments on commit b92ee4e

Please sign in to comment.