Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 337696

Summary: [traceview] possibility of endless loop during view of a physical trace
Product: z_Archived Reporter: Ansgar Radermacher <ansgar.radermacher>
Component: GeclipseAssignee: Harald Kornmayer <harald>
Status: NEW --- QA Contact:
Severity: critical    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

Description Ansgar Radermacher CLA 2011-02-21 04:36:11 EST
Function getEventsByPhysicalClock of class Process.java (geclipse.eventgraph.tracereader.otf) can enter an endless loop, thus blocking the UI thread and requiring a restart of Eclipse

It is reproducible with a simple trace (with just 20 events), if I scroll to the end of the trace. The trace file is available on request. The code below shows the endless while loop and a workaround I installed on my PC.

public Event[] getEventsByPhysicalClock (final int timeStart, final int timeStop )
  {
    ArrayList<Event> events = new ArrayList<Event>();
    if (timeStart < 0) {
	return events.toArray( new Event[ 0 ] );
    }
    try {
      Event event = (Event) getPhysicalEvent( timeStart );
      if( event != null ) {
        if( event.getPhysicalStartClock() <= timeStop )
          events.add( event );
        event = event.getNextEvent();
        int n = 0;  // [ansgar] workaround for infinite loops
        while( event != null && event.getPhysicalStartClock() < timeStop ) {
          events.add( event );
          event = event.getNextEvent();
          if (n++ > 10000) {
            // TODO [ansgar] workaround for infinite loops
            break;
          }
        }
      }
    } catch( IndexOutOfBoundsException e ) {