JDK-4375080 : nsk/regression/b4336548 test hangs on multiprocessor system under Ladybird
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 1.3.0,1.3.1,1.4.0
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris_7
  • CPU: sparc
  • Submitted: 2000-09-29
  • Updated: 2001-12-11
  • Resolved: 2001-05-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.0 beta2Fixed
Related Reports
Relates :  
Description

Name: abR10010			Date: 09/29/2000



The regression test (testbase_nsk) nsk/regression/b4336548 hangs
while running under the HotSpot Client VM (build 1.3.1ea-b01, compiled mode)
(Ladybird) on Solaris.

The test generates two concurrently executed threads and expects
these threads to finish successfully.
The first thread runs in infinite loop waiting signal to finish
from the second thread.
The second thread calls in loop (10 times) the System.gc() method
and then sets a flag for the first thread to finish.

This test hangs when it runs under the HotSpot Client VM (build 1.3.1ea-b01)
in both compiled and mixed modes on the two-processor SPARCstation-10.
In interpreted mode the test passes.

Also the same failure happens when the test runs under the HotSpot Client VM,
build 1.3.0 (kest-sol-rc1).

But the test passes in all modes on the one-processor UltraSPARC.

NOTES.
   This test has been developed on the base of the 4336548 bugreport
   (4336548 (P3/S3) [solaris i386] Compiler Safepoints do not work on multiprocessor systems).
   According to the current state of bugreport this bug had been fixed and
   integrated in kest-sol-beta2 release on Jul 24 2000.


See logs and java source:

In compiled mode:

% java -Xcomp -version
java version "1.3.1ea"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1ea-b01)
Java HotSpot(TM) Client VM (build 1.3.1ea-b01, compiled mode)

% java -Xcomp b4336548
==> nsk/regression/b4336548 test LOG:
----> This test on #4336548 bug; Category: hotspot; Subcategory: runtime_system
      Synopsis: [solaris i386] Compiler Safepoints do not work on multiprocessor systems

----> b4336548: TesterThread started!
----> b4336548: GCThread started!
----> b4336548: waiting threads to finish...
<hanging>


In interpreted mode:

% java -Xint -version
java version "1.3.1ea"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1ea-b01)
Java HotSpot(TM) Client VM (build 1.3.1ea-b01, interpreted mode)

% java -Xint b4336548
==> nsk/regression/b4336548 test LOG:
----> This test on #4336548 bug; Category: hotspot; Subcategory: runtime_system
      Synopsis: [solaris i386] Compiler Safepoints do not work on multiprocessor systems

----> b4336548: TesterThread started!
----> b4336548: GCThread started!
----> b4336548: waiting threads to finish...
----> b4336548: GCThread finished!
----> b4336548: TesterThread finished!
----> b4336548: Both threads finished!
==> nsk/regression/b4336548 test PASSED


The NSK regression test b4336548 java source:
-------------------------------------------------------------------------------
// File: %Z%%M% %I% %E% 
// Copyright %G% Sun Microsystems, Inc. All Rights Reserved

public class b4336548 {
    static public boolean continue_loop = true;
    static Thread s_TesterThread;
    static Thread s_GCThread;	
    static int s_started_threads_count;	
    static boolean s_may_threads_to_run;	
    static Object barrier = new Object();


    public static int run(String argv[], java.io.PrintStream out) {
        int v_test_result = 0/*STATUS_PASSED*/;
        int v_wait_minutes_limit = 5;
        int v_wait_seconds_interval_for_print = 20;

        s_started_threads_count = 0;	
        s_may_threads_to_run = false;	

        System.out.println("==> nsk/regression/b4336548 test LOG:");
        System.out.println("----> This test on #4336548 bug; Category: hotspot; Subcategory: 
runtime_system");
        System.out.println("      Synopsis: [solaris i386] Compiler Safepoints do not work on 
multiprocessor systems\n");

        Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
        new b4336548().start();

        while ( s_started_threads_count != 2 ) {	
            try {
                Thread.sleep(1000);    //sleep for 1 second
            }
            catch (InterruptedException ix) {
            }
        }
        s_may_threads_to_run = true;	

        int v_wait_current_seconds = 0;
        System.out.println("----> b4336548: waiting threads to finish...");
        while ( s_GCThread.isAlive() || s_TesterThread.isAlive() ) {
            try {
                Thread.sleep(1000);    //sleep for 1 second
            }
            catch (InterruptedException ix) {
            }
            v_wait_current_seconds++;
            if ( v_wait_current_seconds >= (v_wait_minutes_limit * 60) ) {
                v_test_result = 2/*STATUS_FAILED*/;
                break;
            }
            if ( v_wait_current_seconds % v_wait_seconds_interval_for_print == 0 ) {
                System.out.println("----> b4336548: waiting threads to finish - "
                                                + v_wait_current_seconds + " seconds!");
            }
        }

        if ( v_test_result == 2/*STATUS_FAILED*/ ) {
            System.out.println("----> b4336548: threads NOT finished during "
                                                + v_wait_minutes_limit + " minutes!");
            System.out.println("==> nsk/regression/b4336548 test FAILED");
        }
        else {
            System.out.println("----> b4336548: Both threads finished!");
            System.out.println("==> nsk/regression/b4336548 test PASSED");
        }
        return v_test_result;
    }

    public static void main(String argv[]) {
        System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
    }
	
    public void start() {
        s_TesterThread = new TesterThread();
        s_TesterThread.setPriority(Thread.MIN_PRIORITY);
        s_TesterThread.start();

        s_GCThread = new GCThread();	
        s_GCThread .setPriority(Thread.MIN_PRIORITY);
        s_GCThread.start();
    }
	
    class TesterThread extends Thread {

        // trick compiler in believing that this is not and endless loop
        public void loop (int fict_int) {
            while ( continue_loop ) {
                if (fict_int == 0) {
                    continue_loop = false;
                }
            }
        }
        
        public void run () {
            System.out.println("----> b4336548: TesterThread started!");
            synchronized (b4336548.barrier) {
                s_started_threads_count++;	
            }
            while ( ! s_may_threads_to_run ) {
                try {
                    Thread.sleep(1000);    //sleep for 1 second
                }
                catch (InterruptedException ix) {
                }
            }
            loop(1);
            System.out.println("----> b4336548: TesterThread finished!");
        }
    }

    class GCThread extends Thread {
        public void run () {
            System.out.println("----> b4336548: GCThread started!");
            synchronized (b4336548.barrier) {
                s_started_threads_count++;	
            }
            while ( ! s_may_threads_to_run ) {
                try {
                    Thread.sleep(1000);    //sleep for 1 second
                }
                catch (InterruptedException ix) {
                }
            }
            long counter = 0;
            while (true) {
                try {
                    sleep(250);
                }
                catch (InterruptedException ix) {
                }
                System.gc();
                counter++;
                if (counter == 10) {
                    continue_loop = false;
                    System.out.println("----> b4336548: GCThread finished!");
                    return;
                }
            }
        }
    }
    
}    // end of b4336548 class 
-------------------------------------------------------------------------------
 

======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: merlin-beta2 FIXED IN: merlin-beta2 INTEGRATED IN: merlin-beta2 VERIFIED IN: merlin-rc1
14-06-2004

EVALUATION The bug does occur on ionpulse. java_g -XX:CompileOnly=loop -Xcomp b433654 will also reproduce the bug. It seems that we do not generate the safepoint (atleast accoring to the disassembler) for v8. mohammad.gharahgouzloo@Eng 2001-01-25 Note, that this bug also happens with c2 in comp mode. mohammad.gharahgouzloo@Eng 2001-01-25 Fixed for beta refresh. will run tests .. mohammad.gharahgouzloo@Eng 2001-04-16
25-01-2001