Skip to content

[FLINK-40675][sql-gateway] Fix unstable SqlGatewayServiceITCase#testReleaseLockWhenFailedToSubmitOperation - #29194

Merged
MartijnVisser merged 1 commit into
apache:masterfrom
SEPURI-SAI-KRISHNA:sql-gateway-release-lock-flaky
Sep 16, 2026
Merged

MartijnVisser merged 1 commit into
apache:masterfrom
SEPURI-SAI-KRISHNA:sql-gateway-release-lock-flaky

Conversation

@SEPURI-SAI-KRISHNA

Copy link
Copy Markdown
Contributor

What is the purpose of the change

testReleaseLockWhenFailedToSubmitOperation fails on CI with a RejectedExecutionException at its final submitOperation. The first operation turns FINISHED on its pool thread, before that thread is back in the pool, and the pool hands work off through a SynchronousQueue. A submit right after awaitOperationTermination can therefore still find no free thread.

Brief change log

  • Retry the final submit until the pool accepts it. Any other exception still fails the test.

Verifying this change

  • With a delay injected after the first operation completes, the old test fails every time with the CI error, and the new test passes.
  • With the lock release on rejection removed, the new test hangs as the old one did, so it still guards the lock.
  • SqlGatewayServiceITCase passes.

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

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Code (Opus 5)

@flinkbot

flinkbot commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

CI report:

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

@MartijnVisser MartijnVisser left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing a test to fix an instability is usually the wrong layer, so why this one is different. The test assumed a pool thread is free once an operation reports FINISHED. It never was: the status is set inside the task, before the worker is back on the SynchronousQueue, and the CI logs show 500 active threads at the moment of rejection. Nothing the pool exposes reliably says a worker will accept work, so the successful submit is the wait, not a loosened assertion. It does give something up. A rejection that is spurious rather than saturation now goes unnoticed for ten seconds. It still fails when it should: with the lock release on rejection removed it hangs, as the old one did. The table stage is green, the only failure is FLINK-40664 and is unrelated.

}
},
Duration.ofSeconds(10),
"Failed to submit the operation after the pool had a free thread.");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This message says the opposite of what a timeout here means. If it fires, the pool never freed a thread.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, reworded: "The pool never freed a thread to accept the operation."

…eleaseLockWhenFailedToSubmitOperation

Generated-by: Claude Code (Opus 5)
@SEPURI-SAI-KRISHNA
SEPURI-SAI-KRISHNA force-pushed the sql-gateway-release-lock-flaky branch from 438f485 to b925916 Compare September 16, 2026 00:09
@MartijnVisser
MartijnVisser merged commit 0abe563 into apache:master Sep 16, 2026
@MartijnVisser

Copy link
Copy Markdown
Contributor

@SEPURI-SAI-KRISHNA Can you also open backport PRs to the release-2.3, release-2.2 and release-1.20 branches?

@SEPURI-SAI-KRISHNA

Copy link
Copy Markdown
Contributor Author

Thanks for the review and merge. Opening the three backports.

@SEPURI-SAI-KRISHNA

Copy link
Copy Markdown
Contributor Author

Backports opened: release-2.3 #29205, release-2.2 #29206, release-1.20 #29207.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants