Open-source graph database, built for real-time streaming data, compatible with Neo4j.
Go to file
Teon Banek 527d69d382 Fix errors with handling SIGSEGV and SIGABRT
Summary:
There were a couple of issues with handling the above 2 signals.

1) Calling `std::exit` from a signal handler is undefined behaviour.

The only defined way for a signal handler to stop the program is calling
one of: `std::_Exit`, `std::abort` or `std::quick_exit`. Neither of them
will completely clean the resources, so a clean exit is not possible.
Since SIGSEGV and SIGABRT happen in extraordinary circumstances that we
wish to debug 99% of the time, it makes sense to generate a core dump
which can be inspected by a debugger. Of the 3 termination functions,
only `std::abort` will generate a core dump, so it makes sense to use
that to stop the program.

Also, since we are now aborting as is the default behaviour on SIGSEGV
and SIGABRT, it becomes questionable why have a custom handler at all.

2) Raising an exception inside a signal handler is undefined behaviour

Although the handler by itself does not raise an exception, it is
possible for the logging facility to raise one. This is a real case when
logging a stack trace in particular. Stack trace is generated by
creating a string "<function name> <line location>". It is possible that
a function name will contain '{}' somewhere inside. This is usually the
case with anonymous functions. The generated string is then passed to
logging, which uses the `fmt` library to fill '{}' with remaining
arguments. Since only a single argument (the stack trace string) is
passed for formatting, naturally the `fmt::format` throws an exception,
that it is missing a format argument.

We could provide an overload which takes a single string, but that
defeats the purpose of `fmt::format` raising an exception in regular
code if we forget to pass an argument. Another solution is to escape the
whole stack trace string, so it is valid for formatting, but this only
complicates the handler even further. The simplest solution is to send
the stack trace to `stderr` and avoid logging altogether.

Simplify Shutdown, so it can be used in a signal handler

Reviewers: florijan, mferencevic, buda, mislav.bradac

Reviewed By: mferencevic, buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D474
2017-06-16 08:53:07 +02:00
cmake Make GNU Readline dependency optional 2017-03-24 12:42:45 +01:00
config Docker mount volume documentation. 2017-06-14 10:15:05 +02:00
docs Added alpha documentation bundle script. 2017-06-14 15:54:15 +02:00
libs Remember token positions for literals 2017-06-13 17:11:27 +02:00
poc Don't pass MEMGRAPH_ALL_LIBS to all cmake targets 2017-06-08 14:14:01 +02:00
release Docker mount volume documentation. 2017-06-14 10:15:05 +02:00
src Fix errors with handling SIGSEGV and SIGABRT 2017-06-16 08:53:07 +02:00
tests Add AST cache 2017-06-14 18:59:31 +02:00
tools/gdb-plugins Add print-operator-tree command to gdb 2017-06-08 09:37:05 +02:00
.arcconfig Set arc.land.onto.default to dev 2017-03-03 13:33:45 +01:00
.clang-format Query - LogicalOp - visitable bug fix 2017-03-22 14:14:01 +01:00
.gdbinit Add print-operator-tree command to gdb 2017-06-08 09:37:05 +02:00
.gitignore Setup and run Neo4j Web Browser + Web socket proxy. 2017-06-08 09:23:10 +02:00
.ycm_extra_conf.py Skiplist garbage collector rework. 2017-06-07 10:47:02 +02:00
CHANGELOG.md Load configs from flagfiles. 2017-06-07 15:38:17 +02:00
CMakeLists.txt Add AST cache 2017-06-14 18:59:31 +02:00
coverage Silence ctest when running for coverage 2017-06-13 11:54:43 +02:00
Doxyfile Enable AUTOBRIEF for doxygen 2017-06-02 08:59:49 +02:00
Doxylogo.png Doxygen setup 2016-12-20 15:49:52 +01:00
format memgraph coverage (lcov setup in progress...) 2017-03-07 18:27:03 +01:00
init init: Add optional & required dependency checking 2017-04-07 09:27:12 +02:00
llvm-gcov memgraph coverage (lcov setup in progress...) 2017-03-07 18:27:03 +01:00
README.md benchmark folder has been removed from the root dir, README update, measure_time.hpp comments 2017-02-18 14:36:50 +01:00

memgraph

Memgraph is an ACID compliant high performance transactional distributed in-memory graph database featuring runtime native query compiling, lock free data structures, multi-version concurrency control and asynchronous IO.

dependencies

Memgraph can be compiled using any modern c++ compiler. It mostly relies on the standard template library, however, some things do require external libraries.

Some code contains linux-specific libraries and the build is only supported on a 64 bit linux kernel.

  • linux
  • clang 3.8 (good c++11 support, especially lock free atomics)
  • antlr (compiler frontend)
  • cppitertools
  • fmt format
  • google benchmark
  • google test
  • yaml-cpp