apache / apache/geaflow

The Issue363 test reports an error "Shutdown in progress" during multiple iterations.

Open
#711 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
808
Forks
188
Avg merge
3d 22h
Merged PRs (30d)
2

Description

**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.

Contributor guide

Open the contributing guide

Research direction

Start with QueryTester.java around lines 155-157 and AbstractComponent.java around line 74, then inspect the Issue363 series tests such as Issue363SF1Test. Reproduce the failure with iterations greater than one and trace environment creation and shutdown. Done means all configured iterations complete without the "Shutdown in progress" error and performance statistics are collected.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.