Bug 183656 - OpenJDK6 JVM crash at startup
Summary: OpenJDK6 JVM crash at startup
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: java (show other bugs)
Version: 8.1-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Jung-uk Kim
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-04 11:30 UTC by Boris Granveaud
Modified: 2013-11-05 21:25 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Boris Granveaud 2013-11-04 11:30:00 UTC
It seems that using together the +UseConcMarkSweepGC and +UseLargePages options with the latest openjdk6 FreeBSD port b28_3 causes the JVM to crash at startup.

It works just by removing one of these options.

This is a regression as it used to work with the version b23_1.

Fix: 

Remove either -XX:+UseConcMarkSweepGC or -XX:+UseLargePages
How-To-Repeat: $  java  -XX:+UseConcMarkSweepGC -XX:+UseLargePages -XX:LargePageSizeInBytes=2m -version
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGFPE (0x8) at pc=0x00000008012d4a9c, pid=44759, tid=100313
#
# JRE version: 6.0_32-b28
# Java VM: OpenJDK 64-Bit Server VM (23.25-b01 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.so+0x4d4a9c]  AsyncGetCallTrace+0x4566c
#
# Core dump written. Default location: /usr/home/bgranveaud/core or core.44759
#
# An error report file with more information is saved as:
# /usr/home/bgranveaud/hs_err_pid44759.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
#
Abort trap: 6 (core dumped)
Comment 1 Jung-uk Kim freebsd_committer freebsd_triage 2013-11-04 18:40:59 UTC
Responsible Changed
From-To: freebsd-java->jkim

Another fallout from HotSpot update.  I'll take it.
Comment 2 Jung-uk Kim freebsd_committer freebsd_triage 2013-11-04 19:16:16 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

FYI, UseLargePages and friends are unnecessary options for FreeBSD.
In fact, these options are also deprecated for Linux.

http://en.wikipedia.org/wiki/Page_%28computer_memory%29#Huge_pages

"Linux has supported huge pages on several architectures since the 2.6
series via the hugetlbfs filesystem and without hugetlbfs since
2.6.38. ... The 2.6.38 kernel introduced support for transparent use
of huge pages. On Linux kernels supporting transparent huge pages, as
well as FreeBSD and Solaris, applications take advantage of huge pages
automatically, without the need for modification."

Jung-uk Kim
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (FreeBSD)

iQEcBAEBAgAGBQJSd/KAAAoJEHyflib82/FGFk8H/1kUc3kElILwXTBrri5ONnVs
t0hWRUgkvD027D2WrhhE3uweLI9XJWgLkepAV9kZompmV/ruunS0+7/jFIo3qjfd
zv0LMuH3HNvs9//Qjz/lbeWVuCb09x1ljoCwxk+C6ya03KIg0RW0RwroY14ivlT2
YmKv1XaaVhzZFGJbuF0isH67E8goy3amebS/K4GoisrZyCJG1JLOZv/nbTxiBiyX
8QnvSV+Qt96L2umCWD8CFuaQn0flbrZL6ZV83QfizpvfA+2471UXkT/1W48mRhGt
V+vBiQ47HxsuarmHMA6VQMWBsXo3CwgsxFNR0LXFcyc4uK0E9OuBSAYrtrqN3IQ=
=GAwN
-----END PGP SIGNATURE-----
Comment 3 dfilter service freebsd_committer freebsd_triage 2013-11-05 21:16:19 UTC
Author: jkim
Date: Tue Nov  5 21:16:12 2013
New Revision: 332909
URL: http://svnweb.freebsd.org/changeset/ports/332909

Log:
  - Do not crash when unsupported options are specified. [1]
  - Micro-optimize and tidy up some patches.
  
  PR:		java/183656 [1]

Modified:
  head/java/openjdk6-jre/Makefile
  head/java/openjdk6/Makefile
  head/java/openjdk6/files/patch-set

Modified: head/java/openjdk6-jre/Makefile
==============================================================================
--- head/java/openjdk6-jre/Makefile	Tue Nov  5 21:10:27 2013	(r332908)
+++ head/java/openjdk6-jre/Makefile	Tue Nov  5 21:16:12 2013	(r332909)
@@ -1,6 +1,6 @@
 # $FreeBSD$
 
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	java devel
 PKGNAMESUFFIX=	-jre
 

Modified: head/java/openjdk6/Makefile
==============================================================================
--- head/java/openjdk6/Makefile	Tue Nov  5 21:10:27 2013	(r332908)
+++ head/java/openjdk6/Makefile	Tue Nov  5 21:16:12 2013	(r332909)
@@ -3,7 +3,7 @@
 
 PORTNAME=	openjdk6
 PORTVERSION=	b28
-PORTREVISION?=	3
+PORTREVISION?=	4
 CATEGORIES=	java devel
 MASTER_SITES=	${MASTER_SITE_APACHE:S,%SUBDIR%/,ant/binaries/:ant,} \
 		http://download.java.net/openjdk/jtreg/promoted/4.1/b05/:jtreg \

Modified: head/java/openjdk6/files/patch-set
==============================================================================
--- head/java/openjdk6/files/patch-set	Tue Nov  5 21:10:27 2013	(r332908)
+++ head/java/openjdk6/files/patch-set	Tue Nov  5 21:16:12 2013	(r332909)
@@ -931,7 +931,18 @@
                         flags, -1, 0);
  
    if (addr != MAP_FAILED) {
-@@ -3654,8 +3756,8 @@
+@@ -3156,7 +3258,9 @@
+ static size_t _large_page_size = 0;
+ 
+ void os::large_page_init() {
+-#ifndef _ALLBSD_SOURCE
++#ifdef _ALLBSD_SOURCE
++  UseLargePages = UseHugeTLBFS = UseSHM = false;
++#else
+   if (!UseLargePages) {
+     UseHugeTLBFS = false;
+     UseSHM = false;
+@@ -3654,8 +3758,8 @@
    return OS_OK;
  #else
    int ret = setpriority(PRIO_PROCESS, thread->osthread()->thread_id(), newpri);
@@ -941,7 +952,7 @@
  }
  
  OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) {
-@@ -4634,6 +4736,20 @@
+@@ -4634,6 +4738,20 @@
  
  int os::active_processor_count() {
  #ifdef _ALLBSD_SOURCE
@@ -7916,12 +7927,12 @@
 -    return thr_suspend(tid->sys_thread);
 +#ifdef __APPLE__
 +    if (thread_suspend(pthread_mach_thread_np(tid->sys_thread)) == KERN_SUCCESS)
++#else
++    if (pthread_suspend_np(tid->sys_thread) == 0)
++#endif
 +        return SYS_OK;
 +    else
 +        return SYS_ERR;
-+#else
-+    return pthread_suspend_np(tid->sys_thread);
-+#endif
  }
  
 -
@@ -7935,30 +7946,42 @@
 -    return thr_continue(tid->sys_thread);
 +#ifdef __APPLE__
 +    if (thread_resume(pthread_mach_thread_np(tid->sys_thread)) == KERN_SUCCESS)
++#else
++    if (pthread_resume_np(tid->sys_thread) == 0)
++#endif
 +        return SYS_OK;
 +    else
 +        return SYS_ERR;
-+#else
-+    return pthread_resume_np(tid->sys_thread);
-+#endif
  }
  
  /*
-@@ -127,26 +105,74 @@
- 
+@@ -122,9 +100,64 @@
+  */
+ void np_initialize_thread(sys_thread_t *tid)
+ {
+-    return;
+ }
  
- /*
++/*
 + * Internal helper function to get stack information about specified thread.
 + */
-+#ifdef __APPLE__
++#if defined(__APPLE__)
 +static int
 +get_stackinfo(pthread_t tid, void **addr, long *sizep)
 +{
 +    void *stacktop = pthread_get_stackaddr_np(tid);
 +    *sizep = pthread_get_stacksize_np(tid);
 +    *addr = stacktop - *sizep;
-+
-+    return (SYS_OK);
++    return SYS_OK;
++}
++#elif defined(__FreeBSD__)
++static int
++get_stackinfo(pthread_t tid, pthread_attr_t *attr, void **addr, long *sizep)
++{
++    if (pthread_attr_get_np(tid, attr) == 0 &&
++        pthread_attr_getstack(attr, addr, sizep) == 0)
++        return SYS_OK;
++    return SYS_ERR;
 +}
 +#elif defined(__OpenBSD__)
 +static int
@@ -7970,45 +7993,44 @@
 +        *addr = (void *)(ss.ss_sp) - ss.ss_size;
 +        *sizep = (long)(ss.ss_size);
 +        return SYS_OK;
-+    } else {
-+        return SYS_ERR; /* pthreads_stackseg_np failed. */
 +    }
++    return SYS_ERR;
 +}
 +#else
 +static int
-+get_stackinfo(pthread_t tid, pthread_attr_t attr, void **addr, long *sizep)
++get_stackinfo(pthread_t tid, pthread_attr_t *attr, void **addr, long *sizep)
 +{
-+    size_t s;
-+    void  *p;
-+    int    ret = SYS_ERR;
-+
-+    if (pthread_attr_get_np(tid, &attr) != 0)
-+        goto err;
-+    if (pthread_attr_getstackaddr(&attr, &p) != 0)
-+        goto err;
-+    if (pthread_attr_getstacksize(&attr, &s) != 0)
-+        goto err;
-+    *addr = p;
-+    *sizep = s;
-+    ret = SYS_OK;
-+err:
-+
-+    return (ret);
++    if (pthread_attr_get_np(tid, attr) == 0 &&
++        pthread_attr_getstackaddr(attr, addr) == 0 &&
++        pthread_attr_getstacksize(attr, sizep) == 0)
++        return SYS_OK;
++    return SYS_ERR;
 +}
 +#endif
 +
-+/*
++#if !defined(__APPLE__) && !defined(__OpenBSD__)
++static int
++get_stackaddr(pthread_t tid, pthread_attr_t *attr, void **addr)
++{
++    if (pthread_attr_get_np(tid, attr) == 0 &&
++        pthread_attr_getstackaddr(attr, addr) == 0)
++        return SYS_OK;
++    return SYS_ERR;
++}
++#endif
+ 
+ /*
   * Get the stack start address, and max stack size for the current thread.
-  */
+@@ -132,21 +165,19 @@
  int
  np_stackinfo(void **addr, long *size)
  {
 -    stack_t stkseg;
-+#if defined(__OpenBSD__) || defined(__APPLE__)
-+    return(get_stackinfo(pthread_self(), addr, size));
++#if defined(__APPLE__) || defined(__OpenBSD__)
++    return get_stackinfo(pthread_self(), addr, size);
 +#else
 +    pthread_attr_t attr;
-+    int    ret = SYS_ERR;
++    int ret;
  
 -    if (thr_stksegment(&stkseg) == 0) {
 -        *addr = (void *)(stkseg.ss_sp);
@@ -8023,16 +8045,16 @@
 -    } else {
 -        return SYS_ERR; /* thr_stksegment failed. */
 +    if (pthread_attr_init(&attr) == 0) {
-+        ret = get_stackinfo(pthread_self(), attr, addr, size);
++        ret = get_stackinfo(pthread_self(), &attr, addr, size);
 +        pthread_attr_destroy(&attr);
++        return ret;
      }
-+
-+    return (ret);
++    return SYS_ERR;
 +#endif
  }
  
  /*
-@@ -155,309 +181,194 @@
+@@ -155,309 +186,192 @@
  void
  np_profiler_init(sys_thread_t *tid)
  {
@@ -8196,7 +8218,7 @@
 -    int ret;
 +{ 
 +    sysAssert(SYS_QUEUE_LOCKED(sysThreadSelf()));
- 
++
 +    /* Iterate over all the threads in the task, suspending each one.
 +     * We have to loop until no new threads appear, and all are suspended */
 +    mach_port_t self = pthread_mach_thread_np(pthread_self());
@@ -8243,7 +8265,7 @@
 +            mach_port_deallocate(self, prev_list[k]);
 +
 +        vm_deallocate(self, (vm_address_t)prev_list, sizeof(thread_t) * prev_count);
-+
+ 
 +        /* Set up the 'new' list for the next loop iteration */
 +        prev_list = cur_list;
 +        prev_count = cur_count;
@@ -8347,14 +8369,14 @@
      }
 +
 +    vm_deallocate(self, (vm_address_t) thr_list, sizeof(thread_t) * thr_count);
-+}
+ }
 +#else
 +void
 +np_multi(void)
 +{
 +    sysAssert(SYS_QUEUE_LOCKED(sysThreadSelf()));
 +    pthread_resume_all_np();
- }
++}
 +#endif
  
  /*
@@ -8453,13 +8475,11 @@
  record_thread_regs()
  {
 +    void *addr;
-+    long sz;
-+
      sys_thread_t *tid;
      int i;
-+    int sp;
-+
-+#ifndef __OpenBSD__
++#if defined(__APPLE__) || defined(__OpenBSD__)
++    long sz;
++#else
 +    pthread_attr_t attr;
 +    int attr_inited;
 +    attr_inited = pthread_attr_init(&attr) == 0;
@@ -8467,15 +8487,15 @@
  
      tid = ThreadQueue;
      for (i = 0; i < ActiveThreadCount && tid != 0; i++) {
-@@ -466,7 +377,14 @@
+@@ -466,7 +380,14 @@
  
              if (tid->sys_thread != 0) {
                  /* if thread has already been initialized */
 -                tid->sp = __gettsp(tid->sys_thread);
-+#if defined(__OpenBSD__) || defined(__APPLE__)
++#if defined(__APPLE__) || defined(__OpenBSD__)
 +            if (get_stackinfo(tid->sys_thread, &addr, &sz) == SYS_OK)
 +#else
-+            if (get_stackinfo(tid->sys_thread, attr, &addr, &sz) == SYS_OK)
++            if (get_stackaddr(tid->sys_thread, &attr, &addr) == SYS_OK)
 +#endif
 +                tid->sp = addr;
 +            else
@@ -8483,7 +8503,7 @@
              } else {
                  /*
                   * thread is still in the process of being initalized.
-@@ -475,192 +393,11 @@
+@@ -475,192 +396,11 @@
                   */
                  tid->sp = 0;
              }
@@ -8516,10 +8536,7 @@
 -#ifdef MY_DEBUG
 -                VM_CALL(jio_fprintf)(stderr, "lwpid %d was not found in process\n",
 -                            lwpid_list[i]);
-+#ifndef __OpenBSD__
-+    if (attr_inited)
-+        pthread_attr_destroy(&attr);
- #endif
+-#endif
 -                continue;
 -            }
 -            memset(&lwpstatus, 0, sizeof(lwpstatus));
@@ -8618,7 +8635,10 @@
 -        if (syscall(SYS_ioctl, procfd, PIOCLWPIDS, lwpid_list) == -1) {
 -#ifdef MY_DEBUG
 -            VM_CALL(jio_fprintf)(stderr, "Can't read proc's lwpid list");
--#endif
++#if !defined(__APPLE__) && !defined(__OpenBSD__)
++    if (attr_inited)
++        pthread_attr_destroy(&attr);
+ #endif
 -            return;
 -        }
 -
@@ -9210,7 +9230,7 @@
  Java_com_sun_management_UnixOperatingSystem_getTotalPhysicalMemorySize
    (JNIEnv *env, jobject mbean)
  {
-+#ifdef _ALLBSD_SOURCE
++#if defined(_ALLBSD_SOURCE) && !defined(_SC_PHYS_PAGES)
 +    jlong result;
 +    int mib[2];
 +    size_t rlen;
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 4 Jung-uk Kim freebsd_committer freebsd_triage 2013-11-05 21:22:32 UTC
State Changed
From-To: open->closed

UseLargePages and friends can no longer crash JVM and they are completely 
no-ops now.  Thanks!