Skip to content
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

Print necessary stackstace information when crashed #700

Merged
merged 2 commits into from
May 21, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions containers/mgmt_frontend/mgmt_frontend_entry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env sh

ARGS=$@

cmd() {
/clipper/release/src/management/management_frontend ${ARGS}
}

ulimit -c unlimited

cmd & pid=$!

wait ${pid}

RESULT=$?

exit ${RESULT}
17 changes: 17 additions & 0 deletions containers/query_frontend/query_frontend_entry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env sh

ARGS=$@

cmd() {
/clipper/release/src/frontends/query_frontend ${ARGS}
}

ulimit -c unlimited

cmd & pid=$!

wait ${pid}

RESULT=$?

exit ${RESULT}
6 changes: 5 additions & 1 deletion dockerfiles/ManagementFrontendDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ RUN cd /clipper/src/libs/spdlog \
&& cd release \
&& make -j4 management_frontend

ENTRYPOINT ["/clipper/release/src/management/management_frontend"]
COPY containers/mgmt_frontend/mgmt_frontend_entry.sh /clipper/

WORKDIR /clipper/

ENTRYPOINT ["/clipper/mgmt_frontend_entry.sh"]

# vim: set filetype=dockerfile:
8 changes: 6 additions & 2 deletions dockerfiles/QueryFrontendDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ RUN cd /clipper/src/libs/spdlog \
&& cd release \
&& make -j4 query_frontend

ENTRYPOINT ["/clipper/release/src/frontends/query_frontend"]
COPY containers/query_frontend/query_frontend_entry.sh /clipper/

# vim: set filetype=dockerfile:
WORKDIR /clipper/

ENTRYPOINT ["/clipper/query_frontend_entry.sh"]

# vim: set filetype=dockerfile:
19 changes: 19 additions & 0 deletions src/frontends/src/query_frontend_main.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@

#include <execinfo.h>
#include <signal.h>

#include <clipper/config.hpp>
#include <clipper/constants.hpp>
#include <clipper/query_processor.hpp>
#include <cxxopts.hpp>

#include "query_frontend.hpp"

void handler(int sig) {
void *array[10];
size_t size;

// get void*'s for all entries on the stack
size = backtrace(array, 10);

// print out all the frames to stderr
fprintf(stderr, "Error: signal %d:\n", sig);
backtrace_symbols_fd(array, size, STDERR_FILENO);
exit(1);
}

int main(int argc, char* argv[]) {
signal(SIGSEGV, handler);

cxxopts::Options options("query_frontend",
"Clipper query processing frontend");
// clang-format off
Expand Down
17 changes: 17 additions & 0 deletions src/management/src/management_frontend_main.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,29 @@

#include <execinfo.h>
#include <signal.h>
#include <cxxopts.hpp>

#include <clipper/config.hpp>
#include <clipper/constants.hpp>

#include "management_frontend.hpp"

void handler(int sig) {
void *array[10];
size_t size;

// get void*'s for all entries on the stack
size = backtrace(array, 10);

// print out all the frames to stderr
fprintf(stderr, "Error: signal %d:\n", sig);
backtrace_symbols_fd(array, size, STDERR_FILENO);
exit(1);
}

int main(int argc, char* argv[]) {
signal(SIGSEGV, handler);

cxxopts::Options options("management_frontend",
"Clipper management interface");

Expand Down