[FLINK-39962] [runtime] Fix flaky DeclarativeSlotPoolBridgeTest
What is the purpose of the change
This pull request fixes the flaky DeclarativeSlotPoolBridgeTest.testAcceptingOfferedSlotsWithoutResourceManagerConnected reported in FLINK-39962.
The Jira describes a test-only threading race: the test used the regular forMainThread() test executor, whose scheduled timeout callbacks can run concurrently with the test thread while close() copies pendingRequests, intermittently producing NegativeArraySizeException.
Brief change log
- Use a
ManuallyTriggeredScheduledExecutorServicefor the affected test. - Manually complete the deferred slot-request declaration task when
slotRequestMaxIntervalis positive. - Keep production slot-pool code unchanged and avoid triggering unrelated request/idle/batch timeout tasks in this test.
Verifying this change
This change is covered by the existing affected test and the containing test class:
./mvnw -pl flink-runtime -Dtest=DeclarativeSlotPoolBridgeTest#testAcceptingOfferedSlotsWithoutResourceManagerConnected -DfailIfNoTests=false -DskipITs -Dfast -Drat.skip=true -Dcheckstyle.skip=true -Dspotless.check.skip=true test./mvnw -pl flink-runtime -Dtest=DeclarativeSlotPoolBridgeTest -DfailIfNoTests=false -DskipITs -Dfast -Drat.skip=true -Dcheckstyle.skip=true -Dspotless.check.skip=true test./mvnw -pl flink-runtime -DskipTests -DskipITs -Drat.skip=true spotless:check./mvnw -pl flink-runtime -DskipTests -DskipITs -Drat.skip=true checkstyle:check
Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): no
- The public API, i.e., is any changed class annotated with
@Public(Evolving): no - The serializers: no
- The runtime per-record code paths (performance sensitive): no
- Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
- The S3 file system connector: no
Documentation
- Does this pull request introduce a new feature? no
- If yes, how is the feature documented? not applicable
Was generative AI tooling used to co-author this PR?
- [X] Yes (please specify the tool below)
Generated-by: Hermes Agent (OpenAI GPT-5.5)
CI report:
- 26ee0321c813f6760cdfaf3dbb3ef57aa903829d Azure: FAILURE
Bot commands
The @flinkbot bot supports the following commands:@flinkbot run azurere-run the last Azure build
@flinkbot run azure
This PR is focused on runtime / slotpool flaky test. There has already been community review/comment, but it still needs maintainer review.
@RocMarshal @1996fanrui could you please take a look when you have time and advise whether this approach is acceptable for this area and can move forward?
@flinkbot run azure