flink icon indicating copy to clipboard operation
flink copied to clipboard

[FLINK-39962] [runtime] Fix flaky DeclarativeSlotPoolBridgeTest

Open qiuyanjun888 opened this issue 5 months ago • 3 comments

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 ManuallyTriggeredScheduledExecutorService for the affected test.
  • Manually complete the deferred slot-request declaration task when slotRequestMaxInterval is 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)

qiuyanjun888 avatar Jun 25 '26 04:06 qiuyanjun888

CI report:

  • 26ee0321c813f6760cdfaf3dbb3ef57aa903829d Azure: FAILURE
Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

flinkbot avatar Jun 25 '26 04:06 flinkbot

@flinkbot run azure

qiuyanjun888 avatar Jun 26 '26 00:06 qiuyanjun888

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?

qiuyanjun888 avatar Jun 26 '26 02:06 qiuyanjun888

@flinkbot run azure

qiuyanjun888 avatar Jul 08 '26 00:07 qiuyanjun888