You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "qiuyanjun888 (via GitHub)" <gi...@apache.org> on 2026/06/25 04:13:23 UTC

[PR] [FLINK-39962] [runtime] Fix flaky DeclarativeSlotPoolBridgeTest [flink]

qiuyanjun888 opened a new pull request, #28535:
URL: https://github.com/apache/flink/pull/28535

   ## 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)
   


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-39962] [runtime] Fix flaky DeclarativeSlotPoolBridgeTest [flink]

Posted by "qiuyanjun888 (via GitHub)" <gi...@apache.org>.
qiuyanjun888 commented on PR #28535:
URL: https://github.com/apache/flink/pull/28535#issuecomment-4805450324

   @flinkbot run Azure


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-39962] [runtime] Fix flaky DeclarativeSlotPoolBridgeTest [flink]

Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #28535:
URL: https://github.com/apache/flink/pull/28535#issuecomment-4795849854

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "26ee0321c813f6760cdfaf3dbb3ef57aa903829d",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "26ee0321c813f6760cdfaf3dbb3ef57aa903829d",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 26ee0321c813f6760cdfaf3dbb3ef57aa903829d UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-39962] [runtime] Fix flaky DeclarativeSlotPoolBridgeTest [flink]

Posted by "qiuyanjun888 (via GitHub)" <gi...@apache.org>.
qiuyanjun888 commented on PR #28535:
URL: https://github.com/apache/flink/pull/28535#issuecomment-4823363400

   @flinkbot run azure re-run


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-39962] [runtime] Fix flaky DeclarativeSlotPoolBridgeTest [flink]

Posted by "qiuyanjun888 (via GitHub)" <gi...@apache.org>.
qiuyanjun888 commented on PR #28535:
URL: https://github.com/apache/flink/pull/28535#issuecomment-4805911872

   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?


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-39962] [runtime] Fix flaky DeclarativeSlotPoolBridgeTest [flink]

Posted by "Jackeyzhe (via GitHub)" <gi...@apache.org>.
Jackeyzhe commented on code in PR #28535:
URL: https://github.com/apache/flink/pull/28535#discussion_r3537746634


##########
flink-runtime/src/test/java/org/apache/flink/runtime/jobmaster/slotpool/DeclarativeSlotPoolBridgeTest.java:
##########
@@ -224,8 +231,15 @@ void testNoConcurrentModificationWhenSuspendingAndReleasingSlot() throws Excepti
 
     @TestTemplate
     void testAcceptingOfferedSlotsWithoutResourceManagerConnected() throws Exception {
+        final ManuallyTriggeredScheduledExecutorService scheduledExecutor =

Review Comment:
   I checked the production path around DeclarativeSlotPoolBridge. I do not think this race can occur in the main code in the same way.
   
   The failing window requires pendingRequests to be mutated while the close path is copying/failing it. In production, slot-pool operations and scheduled callbacks are expected to be serialized through ComponentMainThreadExecutor. The copy-then-clear in cancelPendingRequests() then protects the later fail-request loop from reentrant modifications after the snapshot is created.
   
   So this looks like a test-only flakiness caused by relying on real scheduled timing while closing the bridge from the test thread. Using ManuallyTriggeredScheduledExecutorService here looks reasonable to me.



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-39962] [runtime] Fix flaky DeclarativeSlotPoolBridgeTest [flink]

Posted by "qiuyanjun888 (via GitHub)" <gi...@apache.org>.
qiuyanjun888 commented on PR #28535:
URL: https://github.com/apache/flink/pull/28535#issuecomment-4910273230

   @flinkbot run azure


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-39962] [runtime] Fix flaky DeclarativeSlotPoolBridgeTest [flink]

Posted by "davidradl (via GitHub)" <gi...@apache.org>.
davidradl commented on code in PR #28535:
URL: https://github.com/apache/flink/pull/28535#discussion_r3480007737


##########
flink-runtime/src/test/java/org/apache/flink/runtime/jobmaster/slotpool/DeclarativeSlotPoolBridgeTest.java:
##########
@@ -224,8 +231,15 @@ void testNoConcurrentModificationWhenSuspendingAndReleasingSlot() throws Excepti
 
     @TestTemplate
     void testAcceptingOfferedSlotsWithoutResourceManagerConnected() throws Exception {
+        final ManuallyTriggeredScheduledExecutorService scheduledExecutor =

Review Comment:
   I am curious can this race occur in the main code ?



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [FLINK-39962] [runtime] Fix flaky DeclarativeSlotPoolBridgeTest [flink]

Posted by "qiuyanjun888 (via GitHub)" <gi...@apache.org>.
qiuyanjun888 closed pull request #28535: [FLINK-39962] [runtime] Fix flaky DeclarativeSlotPoolBridgeTest
URL: https://github.com/apache/flink/pull/28535


-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org