[ 
https://issues.apache.org/jira/browse/KAFKA-17113?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ao Li resolved KAFKA-17113.
---------------------------
    Resolution: Fixed

The CDL has fixed this concurrency issue. 

> Flaky Test in 
> GlobalStreamThreadTest#shouldThrowStreamsExceptionOnStartupIfExceptionOccurred
> --------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-17113
>                 URL: https://issues.apache.org/jira/browse/KAFKA-17113
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams, unit tests
>    Affects Versions: 3.9.0
>            Reporter: Ao Li
>            Priority: Minor
>
> The `shouldThrowStreamsExceptionOnStartupIfExceptionOccurred` test expects `
> globalStreamThread.start` throws `startupException` when startup fails. This 
> may not be true in some slow machines. 
>  
> {code:java}
> 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");
>     }
>   }
> }
> {code}
> Consider the following schedule:
> {code}
> main:start:`startupException != null`
> GlobalStreamThread:initialize:`startupException = e;`
> GlobalStreamThread:initialize:`setState(State.DEAD);`
> main:start:`inErrorState()`
> main:start:`throw new IllegalStateException`
> {code}
>  
> 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