mirror of https://gitee.com/bigwinds/arangodb
Merge branch 'devel' of github.com:arangodb/arangodb into devel
This commit is contained in:
commit
8d45b52bc7
|
@ -1,6 +1,10 @@
|
||||||
devel
|
devel
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
* Fix strange shutdown hanger which came from the fact that currently
|
||||||
|
libgcc/libmusl wrongly detect multi-threadedness in statically linked
|
||||||
|
executables.
|
||||||
|
|
||||||
* Enabled IPO with cmake as an option, default is on for release builds without
|
* Enabled IPO with cmake as an option, default is on for release builds without
|
||||||
google tests.
|
google tests.
|
||||||
|
|
||||||
|
|
|
@ -332,10 +332,35 @@ namespace arangodb {
|
||||||
// *restartAction = myRestartAction;
|
// *restartAction = myRestartAction;
|
||||||
// arangodb::application_features::ApplicationServer::server->beginShutdown();
|
// arangodb::application_features::ApplicationServer::server->beginShutdown();
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
|
||||||
|
// The following is a hack which is currently (September 2019) needed to
|
||||||
|
// let our static executables compiled with libmusl and gcc 8.3.0 properly
|
||||||
|
// detect that we are a multi-threaded application.
|
||||||
|
// See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91737 for developments
|
||||||
|
// in gcc/libgcc to address this issue.
|
||||||
|
|
||||||
|
static void* g(void *p) {
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void gg() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void f() {
|
||||||
|
pthread_t t;
|
||||||
|
pthread_create(&t, nullptr, g, nullptr);
|
||||||
|
pthread_cancel(t);
|
||||||
|
pthread_join(t, nullptr);
|
||||||
|
static pthread_once_t once_control = PTHREAD_ONCE_INIT;
|
||||||
|
pthread_once(&once_control, gg);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
// Do not delete this! See lib/Basics/operating-system.h for details.
|
// Do not delete this! See above for an explanation.
|
||||||
ThrowSomeException();
|
if (argc >= 1 && strcmp(argv[0], "not a/valid name") == 0) { f(); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string workdir(arangodb::basics::FileUtils::currentDirectory().result());
|
std::string workdir(arangodb::basics::FileUtils::currentDirectory().result());
|
||||||
|
|
|
@ -2659,20 +2659,3 @@ bool TRI_GETENV(char const* which, std::string& value) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// @brief bug fix for some race on libmusl and static linking
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// The following function just throws an exception and catches it. This is
|
|
||||||
// used on Linux for the case that we link statically and the underlying
|
|
||||||
// C-library is libmusl. This configuration has a bug in libgcc which
|
|
||||||
// triggers a shutdown busy loop (after main), provided the very first
|
|
||||||
// exception being thrown in the life of the process happens in two threads
|
|
||||||
// at the same time. By throwing right at the beginning of main() when the
|
|
||||||
// process is still single-threaded, we circumvent this problem.
|
|
||||||
#ifdef __linux__
|
|
||||||
void ThrowSomeException() {
|
|
||||||
try { throw 42; } catch(int const&) {};
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
|
@ -668,15 +668,6 @@
|
||||||
#define TRI_uid_t uid_t
|
#define TRI_uid_t uid_t
|
||||||
#define TRI_gid_t gid_t
|
#define TRI_gid_t gid_t
|
||||||
|
|
||||||
// The following function just throws an exception and catches it. This is
|
|
||||||
// used on Linux for the case that we link statically and the underlying
|
|
||||||
// C-library is libmusl. This configuration has a bug in libgcc which
|
|
||||||
// triggers a shutdown busy loop (after main), provided the very first
|
|
||||||
// exception being thrown in the life of the process happens in two threads
|
|
||||||
// at the same time. By throwing right at the beginning of main() when the
|
|
||||||
// process is still single-threaded, we circumvent this problem.
|
|
||||||
void ThrowSomeException();
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue