United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4959566 REG: JVM crash on RH3.0 w/ 4F533F4C494E55583F491418160E4350500306
JDK-4959566 : REG: JVM crash on RH3.0 w/ 4F533F4C494E55583F491418160E4350500306

Details
Type:
Bug
Submit Date:
2003-11-25
Status:
Closed
Updated Date:
2012-10-08
Project Name:
JDK
Resolved Date:
2003-12-16
Component:
hotspot
OS:
linux_redhat_3.0
Sub-Component:
runtime
CPU:
x86
Priority:
P2
Resolution:
Fixed
Affected Versions:
1.4.2_02
Fixed Versions:
1.4.2_04 (04)

Related Reports
Backport:
Relates:
Relates:

Sub Tasks

Description
B01:
When we ran EJB/MDBapp for RH3.0, we saw following error:

[24/Nov/2003:19:44:27] WARNING (25936): CORE3283: stderr: #
[24/Nov/2003:19:44:27] WARNING (25936): CORE3283: stderr: # HotSpot Virtual Machine Error, Internal Error
[24/Nov/2003:19:44:27] WARNING (25936): CORE3283: stderr: # Please report this error at
[24/Nov/2003:19:44:27] WARNING (25936): CORE3283: stderr: # http://java.sun.com/cgi-bin/bugreport.cgi
[24/Nov/2003:19:44:27] WARNING (25936): CORE3283: stderr: #
[24/Nov/2003:19:44:27] WARNING (25936): CORE3283: stderr: # Java VM: Java HotSpot(TM) Server VM 
(1.4.2_02-b03 mixed mode)
[24/Nov/2003:19:44:27] WARNING (25936): CORE3283: stderr: #
[24/Nov/2003:19:44:27] WARNING (25936): CORE3283: stderr: # Error ID: 4F533F4C494E55583F491418160E4350500306
[24/Nov/2003:19:44:27] WARNING (25936): CORE3283: stderr: #
[24/Nov/2003:19:44:27] WARNING (25936): CORE3283: stderr: # Problematic Thread: prio=236941732 tid=0x05782ad0 nid=0x6550 allocated
[24/Nov/2003:19:44:27] WARNING (25936): CORE3283: stderr: #
[24/Nov/2003:19:44:27] WARNING (25936): CORE3283: stderr: Heap at VM Abort:
[24/Nov/2003:19:44:27] WARNING (25936): CORE3283: stderr: Heap
[24/Nov/2003:19:44:27] SEVERE ( 5365): CORE3107: Child process closed admin channel

We are using JDK1.4.2_02.
The test machine is bigsqalx4.red.iplanet.com. The instance is in /epxort/as7ur3.
We had run the test two times and got same error. If you need more info, please contact me.
###@###.### 2003-11-25
###@###.### 2003-11-25

                                    

Comments
WORK AROUND

set environment variable LD_ASSUME_KERNEL=2.4.1, this will disable NPTL and
avoid the memory leak.

###@###.### 2003-12-04
                                     
2003-12-04
EVALUATION

The errorid points to os_linux_i486.cpp, 774; further investigation shows
that a pthread_getattr_np() call just failed with ENOMEM. JVM relies on
pthread_getattr_np(), so it has no choice but to abort if the call fails.

Starting from Redhat AS-3 (NPTL-0.60 and later), pthread_getattr_np() will
allocate memory through malloc(), the memory is freed by pthread_attr_destroy().
In JVM, we didn't call pthread_attr_destroy() after pthread_getattr_np(), this
causes a small memory leak whenever pthread_getattr_np() is called (it is
called during thread creation). 

In a long running application, especially when it has created lots of 
threads, the memory leaks could add up and cause an out-of-memory error.
A temporary workaround is to disable NPTL by setting LD_ASSUME_KERNEL to
2.4.1.

###@###.### 2003-12-04

Fix is to call pthread_attr_destroy() after pthread_getattr_np(). It has
been verified with 1.4.2_02 JDK.

###@###.### 2003-12-08

Also I've been told that the issue has been fixed on the libc side too. It 
will be available in the first update RHEL3 U1.

###@###.### 2003-12-08
                                     
2003-12-08
SUGGESTED FIX

In os_linux_i486.cpp: (the same change is also needed in os_linux_amd64.cpp
and os_linux_ia64.cpp)

*** 563,581 ****
       // may return bogus value.
       *bottom = os::Linux::initial_thread_stack_bottom();
       *size   = os::Linux::initial_thread_stack_size();
    } else {
       pthread_attr_t attr;
       int rslt = pthread_getattr_np(pthread_self(), &attr);
!      guarantee(rslt == 0, "pthread_getattr_np must work");
  
       void * top;
       if (pthread_attr_getstackaddr(&attr, &top) != 0 || 
           pthread_attr_getstacksize(&attr, size) != 0) {
           fatal("Can not locate current stack attributes!");
       }
  
       *bottom = (address) align_size_up((uintptr_t)top - *size, os::Linux::page_size());
       *size   = (address)top - *bottom;
    }
    assert(os::current_stack_pointer() >= *bottom &&
           os::current_stack_pointer() < *bottom + *size, "just checking");
--- 563,593 ----
       // may return bogus value.
       *bottom = os::Linux::initial_thread_stack_bottom();
       *size   = os::Linux::initial_thread_stack_size();
    } else {
       pthread_attr_t attr;
+      pthread_attr_init(&attr);
+ 
       int rslt = pthread_getattr_np(pthread_self(), &attr);
! 
!      // JVM needs to know exact stack location, abort if it fails
!      if (rslt != 0) {
!        if (rslt == ENOMEM) {
!          vm_exit_out_of_memory(0, "pthread_getattr_np");
!        } else {
!          fatal1("pthread_getattr_np failed with errno = %d", rslt);
!        }
!      }
  
       void * top;
       if (pthread_attr_getstackaddr(&attr, &top) != 0 || 
           pthread_attr_getstacksize(&attr, size) != 0) {
           fatal("Can not locate current stack attributes!");
       }
  
+      pthread_attr_destroy(&attr);
+ 
       *bottom = (address) align_size_up((uintptr_t)top - *size, os::Linux::page_size());
       *size   = (address)top - *bottom;
    }
    assert(os::current_stack_pointer() >= *bottom &&
           os::current_stack_pointer() < *bottom + *size, "just checking");
                                     
2004-06-11
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
1.4.2_04
generic
tiger-beta

FIXED IN:
1.4.2_04
tiger-beta

INTEGRATED IN:
1.4.2_04
tiger-b32
tiger-beta


                                     
2004-06-14



Hardware and Software, Engineered to Work Together