guarantee(PageArmed == 0) failed: invaliant

Yasumasa Suenaga yasuenag at gmail.com
Tue Nov 25 03:34:44 UTC 2014


Hi all,

My customer encountered crash with below messages:
--------
Internal Error (safepoint.cpp:309)
guarantee(PageArmed == 0) failed: invaliant
--------
 - JDK: JDK6u37 x64
 -  OS: RHEL 5.4 x86_64

I found similar issues in JBS:
 - JDK-7116986
 - JDK-7156454
 - JDK-8033717
  
I read safepoint.cpp in jdk9, I guess this error is caused in below:
--------
     if (int(iterations) == DeferPollingPageLoopCount) {
        guarantee (PageArmed == 0, "invariant") ;
        PageArmed = 1 ;
        os::make_polling_page_unreadable();
     }
--------

"iterations" is defined as "unsigned int", and increments in each loop.
On the other hand, DeferPollingPageLoopCount is defined intx and default
value is "-1" .

"PageArmed" sets to 1.
--------
  if (DeferPollingPageLoopCount < 0) {
    // Make polling safepoint aware
    guarantee (PageArmed == 0, "invariant") ;
    PageArmed = 1 ;
    os::make_polling_page_unreadable();
  }
--------


If "iterations" is overflowed, do we encounter this guarantee ?
I think this "if" statement should rewrite as below:
--------
diff -r 7e08ae41ddbe src/share/vm/runtime/safepoint.cpp
--- a/src/share/vm/runtime/safepoint.cpp	Mon Nov 24 09:57:02 2014 +0100
+++ b/src/share/vm/runtime/safepoint.cpp	Tue Nov 25 12:19:58 2014 +0900
@@ -288,7 +288,8 @@
       // 9. On windows consider using the return value from SwitchThreadTo()
       //    to drive subsequent spin/SwitchThreadTo()/Sleep(N) decisions.
 
-      if (int(iterations) == DeferPollingPageLoopCount) {
+      if ((DeferPollingPageLoopCount >= 0) &&
+                  (int(iterations) == DeferPollingPageLoopCount)) {
          guarantee (PageArmed == 0, "invariant") ;
          PageArmed = 1 ;
          os::make_polling_page_unreadable();
--------


If it is correct, I will file it to JBS and upload webrev.
Could you help me to resolve this issue?


Thanks,

Yasumasa



More information about the hotspot-runtime-dev mailing list