Fix integration_engine crash.

Summary:
This should fix the integration query engine test. I'm not exactly sure what caused the SEGFAULT to occur, but from my debugging sessions; I would say, as an educated guess that it's closely related to logger. What I believe happens is that logger gets somehow initialized from the dynamic_library when it's opened. And when the library is closed the corresponding logger is freed, but, other parts of memgraph still see that instance of logger and trying to use to emit code makes the whole thing crash. I've removed one include of logger from something which gets included in the hardcoded queries, but I noticed there are some more.

I've changed the dlopen to now open with DEEPBIND, which should cause symbols to be resolved locally and not globally and stop the logger from the dynamic lib to interfer with the one used in the rest of memgraph.

Reviewers: buda

Reviewed By: buda

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D234
This commit is contained in:
Dominik Gleich 2017-04-06 11:04:18 +02:00
parent feee6ed80e
commit 919258d6f6
3 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,5 @@
#pragma once
#include "logging/default.hpp"
#include "query/backend/cpp/typed_value.hpp"
#include "utils/assert.hpp"

View File

@ -35,7 +35,10 @@ class DynamicLib : public Loggable {
DynamicLib(const fs::path &lib_path)
: Loggable("DynamicLib"), lib_path(lib_path), lib_object(nullptr) {
// load dynamic lib
dynamic_lib = dlopen(lib_path.c_str(), RTLD_NOW);
// I've added the RTL_DEEPBIND flag when we are opening the dynamic_lib to
// resolve symbols locally instead of globally. For additional information
// take a look at: http://man7.org/linux/man-pages/man3/dlopen.3.html
dynamic_lib = dlopen(lib_path.c_str(), RTLD_NOW | RTLD_DEEPBIND);
if (!dynamic_lib) throw DynamicLibException(dlerror());
dlerror(); /* Clear any existing error */
logger.trace("dynamic lib at ADDRESS({}) was opened", dynamic_lib);

View File

@ -117,7 +117,7 @@ auto LoadQueryPlans(Logger &log, QueryEngineT &engine,
}
/**
* Executa all query plans in file on the path.
* Execute all query plans in file on the path.
*
* @param log external logger reference
* @param engine query engine