Skip to content

fix(mssql): stop SQL Server queries at their timeout - #42659

Merged
salevine merged 5 commits into
releasefrom
fix/mssql-bounded-result-drain
Nov 19, 2026
Merged

salevine merged 5 commits into
releasefrom
fix/mssql-bounded-result-drain

Conversation

@salevine

@salevine salevine commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Description

When a SQL Server query ran past its timeout, the user got the timeout error on time, but the query kept running. It held a worker thread and a pooled connection until it finished, and forever if it never finished. This PR stops the query itself at its timeout.

Fixes internal security finding AIP-FD-38 (no GitHub issue).

The problem

The server wraps each plugin call in its own .timeout() (ActionExecutionSolutionCEImpl). That timeout fires on time and returns the standard timeout error, but it only stops waiting. The plugin's own .timeout() never fired: the query runs as a blocking call before that timer starts. So nothing stopped the query.

With a 3-second timeout, measured with the server's outer timeout in place:

Query release (and before #42639) This PR
SELECT 1; WHILE 1 = 1 SELECT 1 Timeout error after 3 s. Connection still in use 5 s later, and forever Timeout error after 3 s. Connection returned
WAITFOR DELAY '00:00:20' Timeout error after 3 s. Query keeps running on SQL Server until it ends at 20 s Timeout error after 3 s. Query cancelled on SQL Server, connection returned

Before #42639 (driver 11.2.4) the endless queries hung the same way. So this is not a regression from the driver upgrade. That PR moved the endless reading into the plugin's own loop (drainRemainingResults, which reads later results to find their errors), where the finding spotted it.

Changes

  • MssqlPlugin.executeCommon: set the JDBC query timeout from the action timeout, rounded up to whole seconds (MssqlExecuteUtils.queryTimeoutSeconds). The driver cancels the query on SQL Server when it runs out.
  • MssqlExecuteUtils: check the same deadline for each row of the first result and for each later result and row. When it passes, cancel the query and fail with QUERY_TIMEOUT_ERROR_MSG: "The query ran longer than its timeout of N ms, so Appsmith stopped it. Statements in the query that already ran may have been saved."
  • A driver timeout while later results are read is reported as a timeout, not as "A statement in this query failed".
  • If cancelling fails, the timeout is still reported.

Behavior change

  • What users see does not change. A query that runs past its timeout still returns the standard error, PE-QRY-5000 " timed out in N milliseconds. Please increase timeout…", at the timeout. The audit log (EE) still records query.executed with status FAILED and response code PE-QRY-5000. The server's timer starts before the plugin's, so the server's error comes first. The plugin's own timeout message is a backstop.
  • What changes: the query is now cancelled on SQL Server at its timeout. Before, it kept running in the background after the user saw the timeout. For example, an UPDATE that timed out still finished later. Now it stops. Statements that already ran may have been saved, as before.

Automation

/ok-to-test tags="@tag.All"

Testing

  • Client unit tests

  • Server unit tests

  • Cypress

  • Playwright

  • Deploy preview

  • Not applicable

  • MssqlDriverBehaviourTest#endlessLaterResults_stopAtTheQueryTimeout (Testcontainers, SQL Server 2022): endless results, endless update counts and a 20-second WAITFOR, with prepared statements on and off. It checks the exact error, that the query fails in under 10 seconds, and that the connection goes back to the pool. On release it hangs or wrongly succeeds.

  • MssqlExecuteUtilsTest (mocked statements): the plugin's own deadline cancels and fails, a driver timeout reads as a timeout, a later statement's error before the deadline is still reported as a failed statement, and the timeout rounds up to whole seconds.

  • Full SQL Server plugin suite: 117 tests, 0 failures.

Suggested Cypress tags or specs: @tag.Datasource

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Release note

When a SQL Server query runs past its timeout, Appsmith now also stops it on SQL Server. Before, the query kept running in the background after the timeout error, holding a database connection, and a slow `UPDATE` could still finish later. Statements in the query that ran before the timeout may already be saved. If a query needs more time, increase its timeout in the query's settings.

🤖 Generated with Claude Code

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/44594123203
Commit: b5a9220
Cypress dashboard.
Tags: @tag.All
Spec:


Thu, 19 Nov 2026 19:44:07 UTC

The action timeout never stopped a SQL Server query. The plugin runs the
query as a blocking call inside the reactive chain, before the timer of
.timeout() starts, so the timer never fired. A query that ran longer than
its timeout succeeded late, and a query with endless results, such as
SELECT 1; WHILE 1 = 1 SELECT 1, held a worker thread and a pooled
connection forever. This was true before the driver upgrade (#42639) too.
#42639 moved the endless reading into the plugin's own loop, which reads
later results to find their errors.

- Set the JDBC query timeout from the action timeout, rounded up to whole
  seconds. The driver cancels the query on SQL Server when it runs out.
- Check the same deadline while reading rows and later results. When it
  passes, cancel the query and fail with a timeout error that says
  statements that already ran may have been saved.
- Report the driver's timeout during that reading as a timeout, not as a
  failed statement.

Behaviour change: a SQL Server query that runs longer than its timeout
(default 10 seconds, at most 60) now fails. Raise the query's timeout to
allow it more time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@salevine salevine added the ok-to-test Required label for CI label Nov 19, 2026
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • MSSQL queries now respect the configured timeout while executing and processing results, including when additional results are returned.
    • Queries that exceed the timeout are stopped and display a clear timeout error. Statements completed before the timeout may have been saved.
    • Timeout handling applies to both prepared and non-prepared query execution.

The MSSQL plugin applies the configured timeout to prepared and non-prepared statements. It rounds millisecond values up to whole seconds for JDBC and checks a nanosecond deadline while collecting and draining results. When the deadline expires, the plugin cancels the statement and reports a timeout error. It cancels the scheduled task before connection cleanup.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant MssqlPlugin
  participant JDBCStatement
  participant MssqlExecuteUtils
  participant ResultSet
  MssqlPlugin->>JDBCStatement: Set query timeout and execute
  JDBCStatement-->>MssqlPlugin: Return result
  MssqlPlugin->>MssqlExecuteUtils: Populate rows with timeout and deadline
  MssqlExecuteUtils->>ResultSet: Read and drain result rows
  MssqlExecuteUtils->>JDBCStatement: Cancel when the deadline expires
Loading

Possibly related PRs

  • appsmithorg/appsmith#42390: Passes an action query timeout to JDBC through Statement.setQueryTimeout; this PR also configures JDBC query timeouts, with different scope and default behavior.

Suggested reviewers: sondermanish

Merge Risk: Minimal · up to b5a92

This change makes SQL Server queries stop at their configured timeout instead of continuing to hold a worker thread and a pooled connection. The earlier concerns were fixed and covered by tests, and no remaining merge risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(mssql): stop SQL Server queries at their timeout" matches the main change. The PR sets the JDBC query timeout, checks a deadline while reading results, and cancels the running SQL Serve…
Description check Passed The description follows the repository template. It has a Description section with motivation, the problem, the changes, and a behavior change note. It links the security finding AIP-FD-38 and states …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(mssql): stop SQL Server queries at their timeout" matches the main change. The PR sets the JDBC query timeout, checks a deadline while reading results, and cancels the running SQL Server query at its timeout. The title is specific, short, and in the repository's conventional-commit style.

Full details: Description check

Explanation

The description follows the repository template. It has a Description section with motivation, the problem, the changes, and a behavior change note. It links the security finding AIP-FD-38 and states that no GitHub issue exists, which replaces the template's Fixes line. The Testing section lists the server unit tests as checked and names the test classes and results. The Communication section answers the DevRel question. It also includes a release note. Remaining gaps: the Fixes line uses a security finding link instead of an issue number, and the Cypress and deploy-preview boxes are unchecked with no stated reason, which is acceptable. The template's TL;DR tip is optional since the description is under 500 words.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Automatic approval policy

Commit: b5a9220a73f7.

Setting Effective value Source
Automatic approvals Enabled Global configuration
Merge risk Low Global configuration
Security risk Not set Global configuration

Not set means no limit was configured after inheritance. Use @coderabbitai configuration to inspect the resolved settings and their sources.

@salevine salevine added the release-note: security Include in the release notes under Security. Wording comes from the PR's release-note block. label Nov 19, 2026
@salevine
salevine marked this pull request as ready for review November 19, 2026 16:48
@salevine
salevine requested a review from a team as a code owner November 19, 2026 16:48
Copilot AI balanced review requested due to automatic review settings November 19, 2026 16:48

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

Nitpick comments: 2

app/server/appsmith-plugins/mssqlPlugin/src/test/java/com/external/plugins/MssqlDriverBehaviourTest.java: 1

524-525: Trivial · Maintainability & Code Quality · Quick win

Use the required conventions for the added timeout test.

Refactor only this new test:

  • Use StepVerifier for executeParameterized, with AssertJ assertions in assertNext and a bounded completion check.
  • Use Awaitility for connection release instead of the Thread.sleep loop.
  • Make the method package-private, use a should_<expectedBehavior>_when_<condition> name, and add // Given, // When, // Then.

This keeps the timeout regression on the repository's supported assertion and waiting tools.

As per coding guidelines: “StepVerifier for anything that returns Mono or Flux”, “AssertJ … for assertions”, “No Thread.sleep”, and the prescribed test name, separators and package-private visibility apply to new tests.

Also applies to: 540-546, 549-554, 557-565

Source: Coding guidelines

app/server/appsmith-plugins/mssqlPlugin/src/test/java/com/external/plugins/utils/MssqlExecuteUtilsTest.java: 1

48-50: Trivial · Maintainability & Code Quality · Quick win

Make the mocked timeout tests verify the intended path.

If the 50 ms deadline expires before populate starts, the driver-timeout test passes without calling getMoreResults(). Verify that call and assert the simulated SQL exception as the timeout's cause. Replace Thread.sleep with Awaitility or a controllable time source.

Use MockitoExtension and an @Mock Statement for these new tests. Remove the unused getMoreResults() stub from the already-expired test. In the failed-statement test, positively assert SQLException, not only the absence of SQLTimeoutException.

As per coding guidelines: “Mockito with @ExtendWith(MockitoExtension.class)”, “@mock for dependencies”, “No Thread.sleep”, and “Assert the specific exception type and message”.

Also applies to: 65-71, 74-77, 83-95, 103-103

Source: Coding guidelines

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 6f37b29 and 4036fa5.

Files selected for processing: 5

  • app/server/appsmith-plugins/mssqlPlugin/src/main/java/com/external/plugins/MssqlPlugin.java
  • app/server/appsmith-plugins/mssqlPlugin/src/main/java/com/external/plugins/exceptions/MssqlErrorMessages.java
  • app/server/appsmith-plugins/mssqlPlugin/src/main/java/com/external/plugins/utils/MssqlExecuteUtils.java
  • app/server/appsmith-plugins/mssqlPlugin/src/test/java/com/external/plugins/MssqlDriverBehaviourTest.java
  • app/server/appsmith-plugins/mssqlPlugin/src/test/java/com/external/plugins/utils/MssqlExecuteUtilsTest.java

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Review details

Context from checks skipped due to timeout: 3

  • GitHub Check: CodeRabbit
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: server-unit-tests / server-unit-tests
Additional context used

Code guidelines: 1

app/server/AGENTS.md — auto-discovered
Path-based instructions: 2

Review server-side changes with a focus on correctness, performance, security, reliability, and maintainability.

CodeRabbit configuration file

Files:

  • app/server/appsmith-plugins/mssqlPlugin/src/main/java/com/external/plugins/MssqlPlugin.java
  • app/server/appsmith-plugins/mssqlPlugin/src/main/java/com/external/plugins/exceptions/MssqlErrorMessages.java
  • app/server/appsmith-plugins/mssqlPlugin/src/main/java/com/external/plugins/utils/MssqlExecuteUtils.java
  • app/server/appsmith-plugins/mssqlPlugin/src/test/java/com/external/plugins/MssqlDriverBehaviourTest.java
  • app/server/appsmith-plugins/mssqlPlugin/src/test/java/com/external/plugins/utils/MssqlExecuteUtilsTest.java
Source excerpt: JUnit 5 (`org.junit.jupiter.api`).

CodeRabbit inference engine (app/server/AGENTS.md)

Files:

  • app/server/appsmith-plugins/mssqlPlugin/src/main/java/com/external/plugins/MssqlPlugin.java
  • app/server/appsmith-plugins/mssqlPlugin/src/main/java/com/external/plugins/exceptions/MssqlErrorMessages.java
  • app/server/appsmith-plugins/mssqlPlugin/src/main/java/com/external/plugins/utils/MssqlExecuteUtils.java
  • app/server/appsmith-plugins/mssqlPlugin/src/test/java/com/external/plugins/MssqlDriverBehaviourTest.java
  • app/server/appsmith-plugins/mssqlPlugin/src/test/java/com/external/plugins/utils/MssqlExecuteUtilsTest.java

salevine and others added 2 commits November 19, 2026 12:12
Review of the timeout fix found two ways a query could still run past its
timeout:

- After SQL Server sends a first response early, the driver no longer
  runs its own query timeout. A later statement that waits, such as
  WAITFOR, then blocked a read of the results, and the checks between
  reads could not interrupt it. A timer now cancels the query at the
  deadline, on its own virtual thread so that a slow cancel does not
  delay others. The timer is stopped before the connection goes back to
  the pool, and a stopped timer leaves the queue at once.
- An ordinary SQL error after the deadline was reported as a timeout
  without cancelling the query. It now cancels the query first.

Any error after the deadline is reported with the plugin's timeout
message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 19, 2026 18:43

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Nov 19, 2026
@salevine
salevine enabled auto-merge (squash) November 19, 2026 18:59
- The timeout integration test uses StepVerifier, AssertJ and Awaitility,
  is package-private, and has a should_..._when_... name with Given,
  When and Then.
- The driver-timeout unit test now waits until the deadline has passed
  before the simulated driver error, and checks that the read happened
  and that the error is the timeout's cause. It no longer passes without
  reaching that path.
- No Thread.sleep in the new tests. The unused stub is gone, and the
  failed-statement test asserts the exact SQLException type.
- Add Awaitility to the SQL Server plugin's test dependencies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 19, 2026 19:02

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@salevine

Copy link
Copy Markdown
Contributor Author

@coderabbitai Your two nitpicks from the first review are addressed in b5a9220.

MssqlDriverBehaviourTest (timeout test): it now uses StepVerifier with AssertJ in assertNext and a bounded verify(Duration.ofSeconds(30)). Connection release is checked with Awaitility instead of a Thread.sleep loop. The test is package-private, named should_failAndFreeTheConnection_when_theQueryRunsPastItsTimeout, and has Given, When and Then.

MssqlExecuteUtilsTest:

  • The driver-timeout test no longer depends on timing. The simulated read waits until the deadline has passed, then fails. The test checks that getMoreResults() was called and that the driver's exception is the timeout's cause.
  • No Thread.sleep is left. The stopped-timer test uses Mockito after(400).never().
  • The unused getMoreResults() stub is gone from the already-expired test, which now also checks that no later result was read.
  • The failed-statement test asserts isExactlyInstanceOf(SQLException.class).
  • MockitoExtension and @Mock: not applied. The plugins module has mockito-core and mockito-inline, but not mockito-junit-jupiter, so MockitoExtension isn't on its test classpath. The tests use Mockito.mock(...), as the module's other tests do.

Awaitility is added to the SQL Server plugin's test dependencies, with the version from the existing BOM. Both test classes pass: 79 tests, 0 failures.

@coderabbitai

coderabbitai Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

Analysis chain

Script executed:

#!/bin/bash
set -u
printf '%s\n' '--- Current revision ---'
git log -1 --format='%h %s'
printf '%s\n' '--- Locate named test files ---'
fd -t f '^(MssqlDriverBehaviourTest|MssqlExecuteUtilsTest)\.java$' app/server/appsmith-plugins/mssqlPlugin
for name in MssqlDriverBehaviourTest.java MssqlExecuteUtilsTest.java; do
  while IFS= read -r file; do
    printf '\n--- Outline: %s ---\n' "$file"
    ast-grep outline "$file" --items all
    printf '\n--- Relevant test references: %s ---\n' "$file"
    rg -n -C 3 'should_failAndFreeTheConnection_when_theQueryRunsPastItsTimeout|Thread\.sleep|MockitoExtension|@Mock|after\(400\)|getMoreResults|QUERY_TIMEOUT|deadline|StepVerifier|Awaitility' "$file" || true
    if [ "$name" = MssqlExecuteUtilsTest.java ]; then
      printf '\n--- Numbered file: %s ---\n' "$file"
      cat -n "$file"
    else
      line=$(rg -n 'should_failAndFreeTheConnection_when_theQueryRunsPastItsTimeout' "$file" | head -1 | cut -d: -f1)
      if [ -n "$line" ]; then
        start=$((line > 35 ? line - 35 : 1))
        end=$((line + 85))
        printf '\n--- Numbered test window: %s ---\n' "$file"
        cat -n "$file" | sed -n "${start},${end}p"
      fi
    fi
  done < <(fd -t f "^${name//./\\.}$" app/server/appsmith-plugins/mssqlPlugin)
done
printf '\n--- Plugin dependency declarations ---\n'
cat -n app/server/appsmith-plugins/mssqlPlugin/pom.xml | sed -n '1,220p'
printf '\n--- Server Maven Mockito and Awaitility references ---\n'
rg -n -C 3 'mockito-junit-jupiter|mockito-core|mockito-inline|awaitility' app/server --glob 'pom.xml' || true

Length of output: 37739


@salevine Thanks. I checked b5a9220a73. The test changes and Awaitility dependency match your description. Using Mockito.mock(...) is reasonable given the stated test-classpath constraint.

I did not rerun the tests. Thanks for reporting the 79 passing tests.


Learnings added

Learnt from: salevine
URL: https://github.com/appsmithorg/appsmith/pull/42659

Timestamp: 2026-11-19T19:10:31.666Z
Learning: Within repository "appsmithorg/appsmith", only for files matching one of ["app/server/appsmith-plugins/mssqlPlugin/src/test/java/com/external/plugins/utils/MssqlExecuteUtilsTest.java"]: In app/server/appsmith-plugins/mssqlPlugin/src/test/java/com/external/plugins/utils/MssqlExecuteUtilsTest.java, the plugin test classpath has mockito-core and mockito-inline but lacks mockito-junit-jupiter. MockitoExtension is therefore unavailable without adding that dependency; Mockito.mock(...) can be used instead.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


Learnings used

Learnt from: CR
Repo: appsmithorg/appsmith PR: 0
File: app/server/AGENTS.md:0-0
Timestamp: 2026-10-31T13:25:08.869Z
Learning: Applies to app/server/** : Source excerpt:
# Java tests

## Shape of a new test

- No `Thread.sleep`. Use `StepVerifier.withVirtualTime` or Awaitility.
Learnt from: CR
Repo: appsmithorg/appsmith PR: 0
File: app/server/AGENTS.md:0-0
Timestamp: 2026-10-31T13:25:08.869Z
Learning: Applies to app/server/** : Source excerpt:
# Java tests

## Stack

- AssertJ (`assertThat`, `assertThatThrownBy`) for assertions, not `assertEquals` / `assertTrue` / Hamcrest.

You are interacting with an AI system.

@salevine
salevine merged commit ccd358a into release Nov 19, 2026
98 checks passed
@salevine
salevine deleted the fix/mssql-bounded-result-drain branch November 19, 2026 19:44
salevine added a commit that referenced this pull request Nov 21, 2026
)

## Description

When a SQL Server query runs past its timeout, a timer cancels it on SQL
Server from another thread (#42659). At the end of the query, the plugin
stopped that timer. But stopping the timer could not stop a cancel that
the timer had already started. So the connection could go back to the
pool while that cancel was still being sent, and the late cancel could
stop the next query that used the connection. That query can belong to
another app or user of the same datasource.

This PR makes sure a cancel never reaches a connection after it goes
back to the pool:

- `MssqlExecuteUtils.cancelAtDeadline` now returns a `DeadlineCancel`.
Its cancel and its `stop()` share a lock.
  - A cancel that has not started never runs after `stop()`.
  - `stop()` waits for a cancel that is running, up to 5 seconds.
- `stop()` returns false when a cancel ran, or is still running after
that wait.
- The connection is removed from the pool
(`HikariDataSource.evictConnection`) and closed, instead of going back
to it, when:
  - the timer's cancel ran or may still be on its way, or
- the query passed its deadline, because the query thread may then have
cancelled the query itself.
- Its session on SQL Server is then ended at once with
`Connection.abort`, before its statements are closed. So the session
ends even if the pool skips its own close while shutting down, and
closing the statements cannot wait on a server that stopped answering.
If the pool is closed or cannot remove the connection, the session is
still ended, and the connection goes back already closed.
- An info log line names the pool each time a connection is removed this
way.

Only queries that reach their timeout are affected. Their connection is
replaced by a new one, which costs one login to SQL Server. Other
queries are unchanged.

Found by Hacktron
([AIP-FD-39](https://app.hacktron.ai/appsmith-inc/findings/AIP-FD-39)).

## Automation

/ok-to-test tags="@tag.All"

## Testing

- [ ] Client unit tests
- [x] Server unit tests
- [ ] Cypress
- [ ] Playwright
- [ ] Deploy preview
- [ ] Not applicable

- `MssqlExecuteUtilsTest` (mocked statements):
- a cancel that is running makes `stop()` wait, then the connection is
not reused;
- a cancel the timer started, but that has not taken the lock yet, never
runs after `stop()`;
- a cancel still running after the wait, or one that already ran, means
the connection is not reused;
- a timer stopped before the deadline never cancels, and the connection
is reused;
- a connection that is not reusable is removed from the pool and its
session aborted, in that order, before its statement is closed;
- when the pool is closed, cannot remove it, or the abort fails, the
session is still ended.
- `MssqlDriverBehaviourTest` (Testcontainers, SQL Server 2022):
- a query cancelled at its timeout records its own session. The test
checks on SQL Server that this session ends, so the connection was
closed, not lent again. This test fails when only the change in
`MssqlPlugin` is reverted.
- after each timed-out query in the existing timeout test, the next
query on the same pool succeeds.
- With `stop()` changed back to the old behaviour, 4 of the new unit
tests fail. With `stop()` changed to wait without a bound, the
stuck-cancel test fails.
- Full SQL Server plugin suite: 134 tests, 0 failures.

Suggested Cypress tags or specs: `@tag.Datasource`

## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No

## Release note

```release-note
A SQL Server query that ran past its timeout could, in rare cases, stop the next query that used the same database connection. Appsmith now closes the connection of a query that reached its timeout, instead of reusing it. The next query opens a new connection.
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/44832910240>
> Commit: 19d395c
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=44832910240&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Fri, 20 Nov 2026 23:36:33 UTC
<!-- end of auto-generated comment: Cypress test results  -->

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Required label for CI release-note: security Include in the release notes under Security. Wording comes from the PR's release-note block.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants