Print type of singleton that is requested after destruction
authorMisha Shneerson <mshneer@fb.com>
Fri, 24 Jul 2015 18:57:21 +0000 (11:57 -0700)
committerfacebook-github-bot-4 <folly-bot@fb.com>
Fri, 24 Jul 2015 20:22:15 +0000 (13:22 -0700)
Summary: As titled
Trying to troubleshoot shutdown problems in HHVM and I see:
  EventBase::runAfterDelay() callback threw St13runtime_error exception: Raw pointer to a singleton requested after its destruction.
Would be much easier to troubleshoot if I know what is it being requested.

Reviewed By: @chipturner

Differential Revision: D2274497

folly/Singleton-inl.h

index 6bc43ad27d6af4e51d0a295ab1219ce82a33dcb7..3848ab449145d56db1633c1c9e50aa2d7dd3a3eb 100644 (file)
@@ -64,7 +64,9 @@ T* SingletonHolder<T>::get() {
 
   if (instance_weak_.expired()) {
     throw std::runtime_error(
-      "Raw pointer to a singleton requested after its destruction.");
+        "Raw pointer to a singleton requested after its destruction."
+        " Singleton type is: " +
+        type_.name());
   }
 
   return instance_ptr_;