Program: 73158
Project: 73158
Buggy source:
public void run(){
  while (!_stopRequested) {
    try {
      if (ThreadedComposite.this._debugging) {
        ThreadedComposite.this._debug("String_Node_Str");
      }
      TokenFrame frame=_inputFrames.take();
      if (frame.type == TokenFrame.STOP) {
        if (ThreadedComposite.this._debugging) {
          ThreadedComposite.this._debug("String_Node_Str");
        }
        break;
      }
      if (ThreadedComposite.this._debugging) {
        ThreadedComposite.this._debug("String_Node_Str" + frame.time + "String_Node_Str"+ frame.tokens);
      }
      setModelTime(frame.time);
      if (_synchronizeToRealTime) {
        long currentRealTime=System.currentTimeMillis();
        if (_realStartTime < 0L) {
          _realStartTime=currentRealTime;
        }
        long realTimeMillis=currentRealTime - _realStartTime;
        long modelTimeMillis=Math.round(getModelTime().getDoubleValue() * 1000.0);
        if (realTimeMillis < modelTimeMillis) {
          try {
            Thread.sleep(modelTimeMillis - realTimeMillis);
          }
 catch (          InterruptedException e) {
          }
        }
      }
      for (      QueuedToken token : frame.tokens) {
        if (token.channel < token.port.getWidthInside()) {
          token.port.sendInside(token.channel,token.token);
        }
      }
      if (!iterateContainedActors()) {
        break;
      }
      List<QueuedToken> outputTokens=new LinkedList<QueuedToken>();
      Iterator ports=outputPortList().iterator();
      while (ports.hasNext()) {
        IOPort port=(IOPort)ports.next();
        for (int i=0; i < port.getWidth(); i++) {
          if (port.isKnownInside(i) && port.hasTokenInside(i)) {
            Token token=port.getInside(i);
            QueuedToken tokenBundle=new QueuedToken(port,i,token);
            outputTokens.add(tokenBundle);
            if (ThreadedComposite.this._debugging) {
              ThreadedComposite.this._debug("String_Node_Str" + token + "String_Node_Str"+ port.getName());
            }
          }
        }
      }
      Time responseTime=getModelTime().add(_delayValue);
synchronized (ThreadedDirector.this) {
        if (_delayValue < 0.0) {
          if (_synchronizeToRealTime) {
            long realTimeMillis=System.currentTimeMillis() - _realStartTime;
            Time realTime=new Time(ThreadedDirector.this,realTimeMillis * 0.001);
            responseTime=ThreadedDirector.this.fireAt(ThreadedComposite.this,realTime);
          }
 else {
            responseTime=ThreadedDirector.this.fireAt(ThreadedComposite.this,getModelTime());
          }
          _outputTimes.add(responseTime);
        }
        TokenFrame outputFrame=new TokenFrame(responseTime,outputTokens,TokenFrame.EVENT);
        _outputFrames.add(outputFrame);
        if (ThreadedComposite.this._debugging) {
          ThreadedComposite.this._debug("String_Node_Str");
        }
        ThreadedDirector.this.notifyAll();
        Thread.yield();
      }
    }
 catch (    InterruptedException e) {
      TokenFrame stopFrame=new TokenFrame(getModelTime(),null,TokenFrame.STOP);
synchronized (ThreadedDirector.this) {
        _outputFrames.add(stopFrame);
        ThreadedDirector.this.notifyAll();
      }
      break;
    }
catch (    IllegalActionException ex) {
synchronized (ThreadedDirector.this) {
        _exception=ex;
        TokenFrame stopFrame=new TokenFrame(getModelTime(),null,TokenFrame.STOP);
        _outputFrames.add(stopFrame);
        ThreadedDirector.this.notifyAll();
      }
      break;
    }
  }
}

Fixed version (ground truth):
public void run(){
  while (!_stopRequested) {
    try {
      if (ThreadedComposite.this._debugging) {
        ThreadedComposite.this._debug("String_Node_Str");
      }
      TokenFrame frame=null;
synchronized (ThreadedDirector.this) {
        while (_inputFrames.isEmpty() && !_stopRequested) {
          ThreadedDirector.this.wait(1000L);
        }
        if (_stopRequested) {
          break;
        }
        frame=_inputFrames.poll();
      }
      if (frame.type == TokenFrame.STOP) {
        if (ThreadedComposite.this._debugging) {
          ThreadedComposite.this._debug("String_Node_Str");
        }
        break;
      }
      if (ThreadedComposite.this._debugging) {
        ThreadedComposite.this._debug("String_Node_Str" + frame.time + "String_Node_Str"+ frame.tokens);
      }
      setModelTime(frame.time);
      if (_synchronizeToRealTime) {
        long currentRealTime=System.currentTimeMillis();
        if (_realStartTime < 0L) {
          _realStartTime=currentRealTime;
        }
        long realTimeMillis=currentRealTime - _realStartTime;
        long modelTimeMillis=Math.round(getModelTime().getDoubleValue() * 1000.0);
        if (realTimeMillis < modelTimeMillis) {
          try {
            Thread.sleep(modelTimeMillis - realTimeMillis);
          }
 catch (          InterruptedException e) {
          }
        }
      }
      for (      QueuedToken token : frame.tokens) {
        if (token.channel < token.port.getWidthInside()) {
          token.port.sendInside(token.channel,token.token);
        }
      }
      if (!iterateContainedActors()) {
        break;
      }
      List<QueuedToken> outputTokens=new LinkedList<QueuedToken>();
      Iterator ports=outputPortList().iterator();
      while (ports.hasNext()) {
        IOPort port=(IOPort)ports.next();
        for (int i=0; i < port.getWidth(); i++) {
          if (port.isKnownInside(i) && port.hasTokenInside(i)) {
            Token token=port.getInside(i);
            QueuedToken tokenBundle=new QueuedToken(port,i,token);
            outputTokens.add(tokenBundle);
            if (ThreadedComposite.this._debugging) {
              ThreadedComposite.this._debug("String_Node_Str" + token + "String_Node_Str"+ port.getName());
            }
          }
        }
      }
      Time responseTime=getModelTime().add(_delayValue);
synchronized (ThreadedDirector.this) {
        if (_delayValue < 0.0) {
          if (_synchronizeToRealTime) {
            long realTimeMillis=System.currentTimeMillis() - _realStartTime;
            Time realTime=new Time(ThreadedDirector.this,realTimeMillis * 0.001);
            responseTime=ThreadedDirector.this.fireAt(ThreadedComposite.this,realTime);
          }
 else {
            responseTime=ThreadedDirector.this.fireAt(ThreadedComposite.this,getModelTime());
          }
          _outputTimes.add(responseTime);
        }
        TokenFrame outputFrame=new TokenFrame(responseTime,outputTokens,TokenFrame.EVENT);
        _outputFrames.add(outputFrame);
        if (ThreadedComposite.this._debugging) {
          ThreadedComposite.this._debug("String_Node_Str");
        }
        ThreadedDirector.this.notifyAll();
        Thread.yield();
      }
    }
 catch (    InterruptedException e) {
      TokenFrame stopFrame=new TokenFrame(getModelTime(),null,TokenFrame.STOP);
synchronized (ThreadedDirector.this) {
        _outputFrames.add(stopFrame);
        ThreadedDirector.this.notifyAll();
      }
      break;
    }
catch (    IllegalActionException ex) {
synchronized (ThreadedDirector.this) {
        _exception=ex;
        TokenFrame stopFrame=new TokenFrame(getModelTime(),null,TokenFrame.STOP);
        _outputFrames.add(stopFrame);
        ThreadedDirector.this.notifyAll();
      }
      break;
    }
  }
}