From: Andrii Grynenko Date: Thu, 6 Apr 2017 17:10:38 +0000 (-0700) Subject: Require registrationComplete() not only in dbg builds X-Git-Tag: v2017.04.10.00~10 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1b6b202c47642fed52b59360c5c566c20e710e47;p=folly.git Require registrationComplete() not only in dbg builds Summary: Improve error message and change DFATAL to FATAL. Reviewed By: yfeldblum, meyering Differential Revision: D4837840 fbshipit-source-id: 54ae53c9356fc2e85266b037996aa7b2bae3d4e4 --- diff --git a/folly/Singleton-inl.h b/folly/Singleton-inl.h index 2e69d90e..e5b21dd5 100644 --- a/folly/Singleton-inl.h +++ b/folly/Singleton-inl.h @@ -238,8 +238,12 @@ void SingletonHolder::createInstance() { stack_trace = "Stack trace:\n" + stack_trace; } - LOG(DFATAL) << "Singleton " << type().name() << " requested before " - << "registrationComplete() call. " << stack_trace; + LOG(FATAL) << "Singleton " << type().name() << " requested before " + << "registrationComplete() call.\n" + << "This usually means that either main() never called " + << "folly::init, or singleton was requested before main() " + << "(which is not allowed).\n" + << stack_trace; } if (state->state == SingletonVault::SingletonVaultState::Quiescing) { return;