7182040: volano29 limited by os resource on Linux - need better diagnostic message
authoriklam
Tue, 11 Feb 2014 08:43:17 -0800
changeset 22758 c6b6abb73544
parent 22752 5796083e0729
child 22759 d2c32004414f
7182040: volano29 limited by os resource on Linux - need better diagnostic message Summary: Changed message to "unable to create native thread: possibly out of memory or process/resource limits reached" Reviewed-by: dholmes, sla
hotspot/src/share/vm/compiler/compileBroker.cpp
hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp
hotspot/src/share/vm/prims/jvm.cpp
hotspot/src/share/vm/runtime/os.cpp
hotspot/src/share/vm/runtime/os.hpp
hotspot/src/share/vm/runtime/serviceThread.cpp
hotspot/src/share/vm/services/attachListener.cpp
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Mon Feb 10 17:49:17 2014 +0100
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Tue Feb 11 08:43:17 2014 -0800
@@ -955,7 +955,7 @@
 
     if (compiler_thread == NULL || compiler_thread->osthread() == NULL){
       vm_exit_during_initialization("java.lang.OutOfMemoryError",
-                                    "unable to create new native thread");
+                                    os::native_thread_creation_failed_msg());
     }
 
     java_lang_Thread::set_thread(thread_oop(), compiler_thread);
--- a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp	Mon Feb 10 17:49:17 2014 +0100
+++ b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp	Tue Feb 11 08:43:17 2014 -0800
@@ -31,6 +31,7 @@
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/java.hpp"
 #include "runtime/javaCalls.hpp"
+#include "runtime/os.hpp"
 
 // CopyrightVersion 1.2
 
@@ -206,7 +207,7 @@
     // exceptions anyway, check and abort if this fails.
     if (res == NULL || res->osthread() == NULL) {
       vm_exit_during_initialization("java.lang.OutOfMemoryError",
-                                    "unable to create new native thread");
+                                    os::native_thread_creation_failed_msg());
     }
     java_lang_Thread::set_thread(thread_oop(), res);
     java_lang_Thread::set_priority(thread_oop(), NearMaxPriority);
--- a/hotspot/src/share/vm/prims/jvm.cpp	Mon Feb 10 17:49:17 2014 +0100
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Tue Feb 11 08:43:17 2014 -0800
@@ -2875,10 +2875,10 @@
     if (JvmtiExport::should_post_resource_exhausted()) {
       JvmtiExport::post_resource_exhausted(
         JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR | JVMTI_RESOURCE_EXHAUSTED_THREADS,
-        "unable to create new native thread");
+        os::native_thread_creation_failed_msg());
     }
     THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(),
-              "unable to create new native thread");
+              os::native_thread_creation_failed_msg());
   }
 
   Thread::start(native_thread);
--- a/hotspot/src/share/vm/runtime/os.cpp	Mon Feb 10 17:49:17 2014 +0100
+++ b/hotspot/src/share/vm/runtime/os.cpp	Tue Feb 11 08:43:17 2014 -0800
@@ -362,7 +362,7 @@
       // exceptions anyway, check and abort if this fails.
       if (signal_thread == NULL || signal_thread->osthread() == NULL) {
         vm_exit_during_initialization("java.lang.OutOfMemoryError",
-                                      "unable to create new native thread");
+                                      os::native_thread_creation_failed_msg());
       }
 
       java_lang_Thread::set_thread(thread_oop(), signal_thread);
--- a/hotspot/src/share/vm/runtime/os.hpp	Mon Feb 10 17:49:17 2014 +0100
+++ b/hotspot/src/share/vm/runtime/os.hpp	Tue Feb 11 08:43:17 2014 -0800
@@ -807,6 +807,10 @@
 # include "os_bsd_zero.hpp"
 #endif
 
+#ifndef OS_NATIVE_THREAD_CREATION_FAILED_MSG
+#define OS_NATIVE_THREAD_CREATION_FAILED_MSG "unable to create native thread: possibly out of memory or process/resource limits reached"
+#endif
+
  public:
 #ifndef PLATFORM_PRINT_NATIVE_STACK
   // No platform-specific code for printing the native stack.
@@ -829,6 +833,9 @@
   // Hint to the underlying OS that a task switch would not be good.
   // Void return because it's a hint and can fail.
   static void hint_no_preempt();
+  static const char* native_thread_creation_failed_msg() {
+    return OS_NATIVE_THREAD_CREATION_FAILED_MSG;
+  }
 
   // Used at creation if requested by the diagnostic flag PauseAtStartup.
   // Causes the VM to wait until an external stimulus has been applied
--- a/hotspot/src/share/vm/runtime/serviceThread.cpp	Mon Feb 10 17:49:17 2014 +0100
+++ b/hotspot/src/share/vm/runtime/serviceThread.cpp	Tue Feb 11 08:43:17 2014 -0800
@@ -27,6 +27,7 @@
 #include "runtime/javaCalls.hpp"
 #include "runtime/serviceThread.hpp"
 #include "runtime/mutexLocker.hpp"
+#include "runtime/os.hpp"
 #include "prims/jvmtiImpl.hpp"
 #include "services/gcNotifier.hpp"
 #include "services/diagnosticArgument.hpp"
@@ -66,7 +67,7 @@
     // exceptions anyway, check and abort if this fails.
     if (thread == NULL || thread->osthread() == NULL) {
       vm_exit_during_initialization("java.lang.OutOfMemoryError",
-                                    "unable to create new native thread");
+                                    os::native_thread_creation_failed_msg());
     }
 
     java_lang_Thread::set_thread(thread_oop(), thread);
--- a/hotspot/src/share/vm/services/attachListener.cpp	Mon Feb 10 17:49:17 2014 +0100
+++ b/hotspot/src/share/vm/services/attachListener.cpp	Tue Feb 11 08:43:17 2014 -0800
@@ -532,7 +532,7 @@
     // Check that thread and osthread were created
     if (listener_thread == NULL || listener_thread->osthread() == NULL) {
       vm_exit_during_initialization("java.lang.OutOfMemoryError",
-                                    "unable to create new native thread");
+                                    os::native_thread_creation_failed_msg());
     }
 
     java_lang_Thread::set_thread(thread_oop(), listener_thread);