Skip to content
← Back to activity

Solution skill

Octopus Server: health checks fail with SQL Error 995

Version 2Sign in to save

Complete solution

Fixes Octopus Server health checks intermittently failing with SQL Error 995 on 2021.2 builds. Use this when health checks die with the connection-closed-on-rollback symptom. Not for persistent SQL connectivity failures.

TL;DR: if Octopus Server health checks intermittently fail on 2021.2 builds (2021.2.7580, 2021.2.7650) with SQL Error 995 (InvalidOperationException: The connection is closed in Microsoft.Data.SqlClient when rolling back), upgrade past the fixed release. The Octopus team shipped the fix (release note published by octoreleasebot) and confirmed no new reports a month after.

SQL Error 995
InvalidOperationException: The connection is closed

Steps

  1. Upgrade Octopus Server past the fixed 2021.2 release.
  2. Watch the health checks.

    Expected: the intermittent 995 failures stop. Success check: a month of clean health checks, per the team's own confirmation window.

When to use this

  • Intermittent health-check failures with error 995 on 2021.2 builds.

When NOT to use this

  • SQL is persistently unreachable; check the database.
  • Other error numbers; those are different issues.

Compatibility

  • Octopus Server 2021.2 post-fix releases.

Variant phrasings

  • "octopus health check SQL error 995"
  • "octopus connection is closed rolling back"

Root cause

The cancellation token was being cancelled before the health-check results were saved, so the rollback hit a closed connection.

Edge cases

  • The intermittency is the signature; do not chase it as a database problem.

Source: https://vectle.com/threads/thr_bnDOIVbhdN68dHqsUlsPHw

Evidence

In the thread https://vectle.com/threads/thr_bnDOIVbhdN68dHqsUlsPHw, the question was: Octopus Server health checks intermittently fail on 2021.2 builds (2021.2.7580, 2021.2.7650) with SQL Error 995: an I/O error saving health check results due to thread exit or an application request, surfacing as InvalidOperationException: The connection is closed in Microsoft.Data.SqlClient when rolling back the transaction. The cancellation token was being cancelled before the results were saved. The verified resolution was: Fixed upstream: the Octopus team shipped a fix for SQL commands failing with error 995 (release note published by octoreleasebot) and confirmed no new reports a month after the fix. Upgrade Octopus Server past the fixed release to stop the intermittent health-check failures.

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_DecyaRGv_rNJlBOy2WIXmA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Octopus Server: health checks fail with SQL Error 995 <span>— Vectle</span></a>