Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4381856
Votes 0
Synopsis HotSpot reports internal error instead of StackOverflowError (win98)
Category hotspot:runtime_system
Reported Against 1.0.1
Release Fixed
State 11-Closed, duplicate of 4298656, bug
Priority: 4-Low
Related Bugs 4298656
Submit Date 23-OCT-2000
Description




JBuilder 4, dont know wich versjon..


This is a resubmit of this error by request.
Java hotspot outputs this error message when the error is really stack-
overflow. It happends when during recursion. I've included the java source. It
should be devided into three files(Test.java, sNodeList.java and sNode.java).
The class Test.java is the main class. It sorts a linked list of sNodes (nodes
containing a double value) by recursion. The class Test includes a loop that
generates the linked list. By changing the limits in the loop you should be
able to regenerate the error. The error seam to appear only near the
stackoverflow-limit (around 13500 objects..). Good luck with the debugging..

# HotSpot Virtual Machine Error, Internal Error
# Please report this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
#
# Error ID: 53484152454432554E54494D450E43505000D8

//Test.java - a class for testing this problem..

public class Test{

  sNodeList liste;

  public static void main(String args[]){
    Test testApp = new Test();
  }

  public Test(){

    liste = new sNodeList();
    
    //Loop that generates a linked list of sNode's
    //13500 nodes makes the hotspot crash...
        
     for (int i=0; i<13500; i++){
      double x = Math.random()*100;
      liste.addElement(new sNode(x));
    }
    
    long start = System.currentTimeMillis(); //Just timing the sorting..
    
    liste.sort();  //Sorting the list
    
    long stop = System.currentTimeMillis();
    
    long tot = stop - start;
    
    System.out.println("Objects sorted in : " + tot + "ms");

  }
}








//SNodeList.java
//A linked list of sNode - objects


public class sNodeList{

  sNode header;
  sNode tail;

  public sNodeList(){

    header = new sNode(0.0);
    tail = new sNode(0.0);
    tail.setPrev(header);
    header.setNext(tail);
  }

  public void addElement(sNode s){
    tail.getPrev().setNext(s);
    s.setNext(tail);
    s.setPrev(tail.getPrev());
    tail.setPrev(s);
  }

  public String toString(){
    String str = "";
    sNode tmpNode = header.getNext();
    while(tmpNode != tail) {
      str += tmpNode.toString() + "\n";
       tmpNode = tmpNode.getNext();}
    return str;
  }

  public void sort(){
  //Here is the call that makes trouble...
   header.getNext().sortMe(false);
    }
  public sNode getHead(){ return header; }
} //end of sNodeList class







//sNode.java

public class sNode{
private double tall;
private sNode prev;
private sNode next;

public sNode(double tall){
  this.tall = tall;
  next = null;
  prev = null;
}

public String toString() {return tall + "";}

public sNode getNext(){ return next; }

public sNode getPrev(){ return prev; }

public void setNext(sNode next){ this.next = next; }

public void setPrev(sNode prev){ this.prev = prev; }

public boolean isLast(){ return (next == null) ; }
public boolean isFirst(){ return (prev.getPrev()== null); }

//This function is recursive and  customer -recursive (it calls the
//same function in another  customer ..
//It goes first to the end of the list, and then starting moving
//to the front, bubbling every  customer  that's not sorted
//backwards (to the end of the list).


public void sortMe(boolean backward){
  if (next.isLast()) { return ; }
  if (! backward) {next.sortMe(false);} //Goes to the end of the list
  if (rCompare()) { rSwap(); sortMe(true);} //Bubbles this element if not sorted
}


public boolean rCompare(){
    if ( this.tall > next.getTall()){ return true; }
    return false;
  }


public void rSwap(){
    next.setPrev(prev);
    prev = next;
    next = next.getNext();
    next.setPrev(this);
    prev.setNext(this);
    prev.getPrev().setNext(prev);
   }

  public double getTall(){ return this.tall; }
}//End of sNode class
(Review ID: 111190) 
======================================================================
Work Around
N/A
Evaluation
N/A
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang