JDK-5061322 : Excessive use of system calls such as gettimeofday() at startup
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 5.0
  • Priority: P5
  • Status: Closed
  • Resolution: Won't Fix
  • OS: linux
  • CPU: x86
  • Submitted: 2004-06-10
  • Updated: 2004-08-06
  • Resolved: 2004-08-06
Description

Name: jl125535			Date: 06/10/2004


FULL PRODUCT VERSION :
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Linux jupiter 2.6.5-1.358 #1 Sat May 8 09:04:50 EDT 2004 i686 i686 i386 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
running "java" makes an excessive number of system calls.  For example it calls gettimeofday 871 times, even when I'm only running "java -version". I have not looked at other system calls, but the strace generated 1285 lines.

This is actually an improvement over j2sdk1.4.2_04 which called gettimeofday 1431 times!



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
 strace java -version

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
at most one call to gettimeofday at start up.
ACTUAL -
871 calls to gettimeofday

ERROR MESSAGES/STACK TRACES THAT OCCUR :
$ wc -l java_linux_strace.txt
1488 java_linux_strace.txt
$ sort -u java_linux_strace.txt | wc -l
1285
$ grep gettimeofday java_linux_strace.txt | wc -l
871
$


[...]
gettimeofday({1086337286, 552231}, NULL) = 0
gettimeofday({1086337286, 552496}, NULL) = 0
gettimeofday({1086337286, 552752}, NULL) = 0
gettimeofday({1086337286, 575736}, NULL) = 0
gettimeofday({1086337286, 576172}, NULL) = 0
gettimeofday({1086337286, 576397}, NULL) = 0
gettimeofday({1086337286, 576673}, NULL) = 0
[...]

REPRODUCIBILITY :
This bug can be reproduced always.
(Incident Review ID: 276269) 
======================================================================

Comments
EVALUATION Workaround exists for 1.5.0. Measured performance difference with and without flag -XX:-UsePerfData and overall it made no difference so no change will be made.
07-08-2004

WORK AROUND Workaround for gettimeofday() calls during java -version is -XX:-UsePerfData. Using this flag will prevent vm internal performance data from being gathered - which is used both by the Monitoring & Management API as well as by small diagnostic utilities such as jvmstat, but it will seriously reduce the gettimeofday calls. Alternative workaround -XX:PerfDataSamplingInterval=500 will reduce the gettimeofday overhead significantly as well, while still obtaining some diagnostic data.
07-08-2004