Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-17113

Flaky Test in GlobalStreamThreadTest#shouldThrowStreamsExceptionOnStartupIfExceptionOccurred

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.9.0
    • None
    • streams, unit tests
    • None

    Description

      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 schedule:

      main:start:`startupException != null`
      GlobalStreamThread:initialize:`startupException = e;`
      GlobalStreamThread:initialize:`setState(State.DEAD);`
      main:start:`inErrorState()`
      main:start:`throw new IllegalStateException`
      

       
      The function throws `IllegalStateException("Initialization for the global stream thread failed")` instead of `startupexception`

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              aoli-al Ao Li
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: