From owner-freebsd-java@FreeBSD.ORG Sun Feb 6 10:10:19 2005 Return-Path: Delivered-To: freebsd-java@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6221016A4CE for ; Sun, 6 Feb 2005 10:10:19 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 23BDF43D1D for ; Sun, 6 Feb 2005 10:10:19 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.1/8.13.1) with ESMTP id j16AAIAN079058 for ; Sun, 6 Feb 2005 10:10:18 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.1/8.13.1/Submit) id j16AAIuw079057; Sun, 6 Feb 2005 10:10:18 GMT (envelope-from gnats) Resent-Date: Sun, 6 Feb 2005 10:10:18 GMT Resent-Message-Id: <200502061010.j16AAIuw079057@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-java@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Anthony Ginepro Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8543716A4CE for ; Sun, 6 Feb 2005 10:06:50 +0000 (GMT) Received: from renaissance.homeip.net (m197.net81-67-151.noos.fr [81.67.151.197]) by mx1.FreeBSD.org (Postfix) with ESMTP id B53AE43D1D for ; Sun, 6 Feb 2005 10:06:49 +0000 (GMT) (envelope-from rapiere@renaissance.homeip.net) Received: by renaissance.homeip.net (Postfix, from userid 1001) id 2F5782073; Sun, 6 Feb 2005 11:06:48 +0100 (CET) Message-Id: <20050206100648.2F5782073@renaissance.homeip.net> Date: Sun, 6 Feb 2005 11:06:48 +0100 (CET) From: Anthony Ginepro To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: java/77162: Tomcat5 regression with jdk15-p1 X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Anthony Ginepro List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Feb 2005 10:10:19 -0000 >Number: 77162 >Category: java >Synopsis: Tomcat5 regression with jdk15-p1 >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-java >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Feb 06 10:10:18 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Anthony Ginepro >Release: FreeBSD 5.3-STABLE i386 >Organization: >Environment: System: FreeBSD renaissance.homeip.net 5.3-STABLE FreeBSD 5.3-STABLE #1: Sun Feb 6 10:02:52 CET 2005 rapiere@renaissance.homeip.net:/usr/obj/usr/src/sys/CUSTOM_20041231 i386 Tomcat 5.0 and 5.5 >Description: Tomcat 5.x becomes much slower with jdk15-p1 than jdk15-exp as reported in : http://marc.theaimsgroup.com/?l=freebsd-java&m=110633266311615&w=2 After some experiments, I get back normal operations when reverting hotspot/src/os/bsd/vm/os_bsd.cpp (which is what the patch joined does). >How-To-Repeat: Start Tomcat 5.x and check logs/catalina.out for startup time. Try JSP pages which are also slow the first time. >Fix: --- os_bsd.cpp Sun Feb 6 10:49:29 2005 +++ /data/jdk15-new1/work/hotspot/src/os/bsd/vm/os_bsd.cpp Sat Feb 5 17:36:49 2005 @@ -1,8 +1,10 @@ +// XXXBSD: check usage of ::sleep()s (looks like Solaris's ones are defined +// in miliseconds, but FreeBSD's in seconds (convert to usleep/nanosleep?) // XXXBSD: double check of semantics of mmap() and family -// XXXBSD: understand meaning and workaround related to yield +// XXXBSD: understanmd meaning and workaround related to yield /* - * $Id: os_bsd.cpp,v 1.6 2005/01/19 10:38:57 phantom Exp $ + * $Id: os_bsd.cpp,v 1.4 2005/01/08 10:35:51 phantom Exp $ */ /* * Copyright 2004 Sun Microsystems, Inc. All rights reserved. @@ -38,14 +40,6 @@ #if defined(__FreeBSD__) # include #endif -#if defined(__NetBSD__) -# include -# include -# define pthread_yield() sched_yield() -# define pthread_getprio(a) 0 -# define pthread_setprio(a, b) 0 -# define pthread_main_np() 0 -#endif #define MAX_PATH (1 * K) @@ -377,7 +371,7 @@ void os::init_system_properties_values() { -#ifdef _ALLBSD_SOURCE +#ifdef __FreeBSD__ struct utsname uts; uname(&uts); const char *arch = uts.machine; @@ -416,7 +410,7 @@ #define malloc(n) (char*)NEW_C_HEAP_ARRAY(char, (n)) #define getenv(n) ::getenv(n) -#define DEFAULT_LD_LIBRARY_PATH "/usr/lib:/usr/local/lib" /* See ld.so.1(1) */ +#define DEFAULT_LD_LIBRARY_PATH "/usr/lib" /* See ld.so.1(1) */ #define EXTENSIONS_DIR "/lib/ext" #define ENDORSED_DIR "/lib/endorsed" @@ -1380,7 +1374,6 @@ // Prints the names and full paths of all opened dynamic libraries // for current process void os::print_dll_info(outputStream * st) { -#ifdef RTLD_DI_LINKMAP Dl_info dli; void *handle; Link_map *map; @@ -1412,10 +1405,6 @@ } dlclose(handle); - return; -done: -#endif - st->print_cr("Error: Cannot print dynamic libraries."); } bool _print_ascii_file(const char* filename, outputStream* st) { @@ -1560,7 +1549,7 @@ // Look for JAVA_HOME in the environment. char* java_home_var = ::getenv("JAVA_HOME"); if (java_home_var != NULL && java_home_var[0] != 0) { -#ifdef _ALLBSD_SOURCE +#ifdef __FreeBSD__ struct utsname uts; char cpu_arch[12]; uname(&uts); @@ -1887,22 +1876,50 @@ } static int os_sleep(jlong millis, bool interruptible) { - struct timespec t; + const jlong limit = INT_MAX; + jlong prevtime; int res; - t.tv_sec = millis / 1000L; - t.tv_nsec = (millis % 1000L) * 1000000; + while (millis > limit) { + if ((res = os_sleep(limit, interruptible)) != OS_OK) + return res; + millis -= limit; + } + + // Restart interrupted polls with new parameters until the proper delay + // has been completed. + + prevtime = getTimeMillis(); + + while (millis > 0) { + jlong newtime; + if (!interruptible) { - do { - res = nanosleep(&t, &t); - } while ((res == OS_ERR) && (errno == EINTR)); + // Following assert fails for os::yield_all: + // assert(!thread->is_Java_thread(), "must not be java thread"); + res = poll(NULL, 0, millis); } else { assert(Thread::current()->is_Java_thread(), "must be java thread"); - INTERRUPTIBLE_NORESTART(nanosleep(&t, &t), res, os::Bsd::clear_interrupted); + INTERRUPTIBLE_NORESTART_VM(poll(NULL, 0, millis), res, + os::Bsd::clear_interrupted); } // INTERRUPTIBLE_NORESTART_VM returns res == OS_INTRPT for thread.Interrupt - return res; + if((res == OS_ERR) && (errno == EINTR)) { + newtime = getTimeMillis(); + assert(newtime >= prevtime, "time moving backwards"); + /* Doing prevtime and newtime in microseconds doesn't help precision, + and trying to round up to avoid lost milliseconds can result in a + too-short delay. */ + millis -= newtime - prevtime; + if(millis <= 0) + return OS_OK; + prevtime = newtime; + } else + return res; + } + + return OS_OK; } int os::Bsd::naked_sleep() { >Release-Note: >Audit-Trail: >Unformatted: