SeasonPilot opened a new issue, #711:
URL: https://github.com/apache/geaflow/issues/711

   **Describe the bug**
   When running the Issue363 series tests (e.g., Issue363SF1Test) with the 
number of iterations set to 5 (or any value greater than 1), the test fails at 
the second iteration with the error message "Shutdown in progress".
   
   This occurs because the `QueryTester.execute()` method calls 
`environment.shutdown()` in the `finally` block after each execution, which 
triggers the JVM's shutdown hooks. When the test loop proceeds to the second 
iteration and attempts to create a new `Environment`, the component 
initialization code (`AbstractComponent.init()`) tries to register a new 
shutdown hook. However, since the JVM is already in the shutdown process, an 
`IllegalStateException` is thrown.
   
   **Expected behavior**
   The test should complete all configured iterations (e.g., 5 iterations) 
successfully to properly collect and calculate performance statistics. Multiple 
iterations should not be affected by the environment shutdown of the previous 
iteration, or the test should support reusing the same environment instance 
across multiple iterations.
   
   **Additional context**
   
   Error Flow:
   First iteration → QueryTester.execute() → environment.shutdown()
   Triggers JVM shutdown hooks → ClusterMetaStore.close()
   Second iteration → new Environment → AbstractComponent.init()
   Runtime.getRuntime().addShutdownHook() → Throws IllegalStateException: 
Shutdown in progress
   
   Root Cause: This issue is specific to the test pattern where 
`QueryTester.build().execute()` is called in a loop within a single `@Test` 
method. This leads to repeated creation and destruction of the environment, 
conflicting with the one-time nature of JVM shutdown hooks.
   
   Key Files:
   - AbstractComponent.java: Line 74 (Attempts to add a shutdown hook on each 
initialization)
   - QueryTester.java: Lines 155-157 (Forces environment shutdown after 
execution)
   
   Recommended Fix: Modify `QueryTester` to support reusing an existing 
`Environment` via a `withEnvironment()` method, thereby avoiding repeated 
triggering of the JVM shutdown process in loops.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to