Ao Li created KAFKA-17113:
-----------------------------

             Summary: Flaky Test in 
GlobalStreamThreadTest#shouldThrowStreamsExceptionOnStartupIfExceptionOccurred
                 Key: KAFKA-17113
                 URL: https://issues.apache.org/jira/browse/KAFKA-17113
             Project: Kafka
          Issue Type: Bug
          Components: streams
            Reporter: Ao Li


The `shouldThrowStreamsExceptionOnStartupIfExceptionOccurred` test expects `
globalStreamThread.start` throws `startupException` when startup fails. This 
may not be true in some slow machines. 

 
```
class GlobalStreamThread {
  Exception startupException;
  void initialize() {
    try {
      ...
    } catch (Exception e) {
      startupException = e;
    }
    ...
    setState(State.DEAD);
  }

 

  void start() {
    super.start();
    while (stillInitializing()) {
      Utils.sleep(1);
      if (startupException != null) {
        throw startupexception;
      }
    }

    if (inErrorState()) {
      throw new IllegalStateException("Initialization for the global stream 
thread failed");
    }
  }
}
```

Consider the following interleaving: 
 
```
main:start:19
GlobalStreamThread:initialize:7
GlobalStreamThread:initialize:10
main:start:24
main:start:25
```
 
The function throws `IllegalStateException("Initialization for the global 
stream thread failed")` instead of `startupexception`



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to