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

Fix static initializer priority for namespaces in LTO builds #6591

Merged
merged 1 commit into from Sep 4, 2018

Conversation

dnsmichi
Copy link
Contributor

@dnsmichi dnsmichi commented Sep 4, 2018

Tested with both ICINGA2_LTO_BUILD=OFF/ON.

fixes #6575

@dnsmichi dnsmichi added this to the 2.10.0 milestone Sep 4, 2018
@dnsmichi dnsmichi added the core/build-fix Follow-up fix, not released yet label Sep 4, 2018
#include "config/configcompiler.hpp"
#include "config/configcompilercontext.hpp"
#include "config/configitembuilder.hpp"

#include <iostream>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you forgot to remove some debug changes :P

@@ -145,7 +147,14 @@ bool DaemonUtility::ValidateConfigFiles(const std::vector<std::string>& configs,
if (!success)
return false;

#ifdef I2_DEBUG
//std::cout << "Global NS: " << Serialize(ScriptGlobal::GetGlobals()) << std::endl;
#endif /* I2_DEBUG */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's on purpose, also the above include.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's dead code 💀

@@ -51,7 +55,7 @@ INITIALIZE_ONCE_WITH_PRIORITY([]() {

Namespace::Ptr internalNS = new Namespace(l_InternalNSBehavior);
globalNS->SetAttribute("Internal", std::make_shared<ConstEmbeddedNamespaceValue>(internalNS));
}, 50);
}, 1000); /* This. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason for this comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment above which explains the priority. I fear that this is changed or overseen in the future.

@Crunsher
Copy link
Contributor

Crunsher commented Sep 4, 2018

Tested with Debian Jessie and gcc 8.2.0. With LTO and without, with LTO Icinga 2 does not terminate properly:

icinga2: /usr/include/boost/thread/pthread/recursive_mutex.hpp:113: void boost::recursive_mutex::lock(): Assertion `!pthread_mutex_lock(&m)' failed.
[1]    11140 abort      icinga2 daemon

This happens when run in the foreground as well as when started/stopped as a service. I'll rebuild the master with LTO enabled to find out whether this is a problem with this patch or with LTO builds themself.

@dnsmichi
Copy link
Contributor Author

dnsmichi commented Sep 4, 2018

That's a known problem with debug builds, you won't see that with release builds. I'll drop the dead code for now, just for you :-P

@dnsmichi dnsmichi force-pushed the bugfix/lto-builds-static-initialize-namespaces branch from d9d86f1 to 19993df Compare September 4, 2018 14:36
@dnsmichi dnsmichi merged commit 1c2a59b into master Sep 4, 2018
@dnsmichi dnsmichi deleted the bugfix/lto-builds-static-initialize-namespaces branch September 4, 2018 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core/build-fix Follow-up fix, not released yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LTO builds fail on Linux
2 participants