Part 6 (Unhandled Errors)

When you exit your pipeline with CTRL+C, you may notice a stack trace thrown:

$ ./build/tutorial_pipeline
(2022-02-02 14:04:56.829) [info] ( HTTP Server is listening on "".
^C***** INTERRUPT *****
(2022-02-02 14:04:57.633) [info] ( Shutting down all stages...
terminate called after throwing an instance of 'std::runtime_error'
  what():  Received interrupt request, aborted execution early.
***** CAUGHT SIGABRT *****
PC@            226294c ark::core::(anonymous namespace)::failure_signal_handler(int, siginfo_t*, void*) at /home/desktop/ark/ark/core/
PC@       7f5fc37913bf (unknown)
PC@       7f5fc348118b raise
PC@       7f5fc3460858 abort
PC@            2291e99 __gnu_cxx::__verbose_terminate_handler() [clone .cold]
PC@            2290925 __cxxabiv1::__terminate(void (*)())
PC@            2290960 std::terminate()
PC@            2290a83 __cxa_throw
PC@            22702a2 __wrap___cxa_throw at /home/desktop/ark/ark/core/
PC@             834f9c void ark::main::(anonymous namespace)::execute_pipeline<ark::pipeline::RealTimeExecutor>(int, char const**, ark::pipeline::Pipeline, ark::main::MainOffboardConfiguration const&) at /home/desktop/ark/ark/main/
PC@             832955 ark::main::execute_realtime_pipeline(int, char const**, ark::pipeline::Pipeline, ark::main::MainOffboardConfiguration) at /home/desktop/ark/ark/main/
PC@             82547f main at /home/desktop/ark/tutorial/pipeline/
PC@       7f5fc34620b2 __libc_start_main
PC@             82502d _start
PC@   ffffffffffffffff (unknown)

This is normal. When your pipeline encounters an unhandled signal or exception, it will print a stack trace of the offending location.

We can avoid the stack trace by print error messages out more gracefully.

Let’s do so now by adjusting our ${APP_ROOT}/tutorial/pipeline/

#include "tutorial/first_stage/first_stage.hh"
#include "tutorial/second_stage/second_stage.hh"

#include "ark/comms/stages/http_server_stage.hh"
#include "ark/debuglog/log.hh"
#include "ark/main/main_offboard.hh"

int main(int argc, const char **argv)
    ark::pipeline::Pipeline pipeline;


        return ark::main::execute_realtime_pipeline(argc, argv, std::move(pipeline));
    catch (const std::exception &exception)
        LERROR("Exiting due to error: {}", exception.what());
        return 1;

Update your pipeline’s CMakeLists.txt file to include the debug logger:


    PRIVATE first_stage second_stage ark::main_offboard ark::http_server_stage ark::debuglog)

We’ll next discuss creating multiple instances of the same stage in Part 7.