fix(persistence): bump gorqlite to avoid panic on empty rqlite write results - #5994
fix(persistence): bump gorqlite to avoid panic on empty rqlite write results#5994kriscoleman wants to merge 1 commit into
Conversation
| panic(err) | ||
| } | ||
| db = &newDB | ||
| db = newDB |
There was a problem hiding this comment.
the upstream gorqlite version had a breaking change with this type-signature, so this was changed due to that
|
Reviews (1): Last reviewed commit: "fix(persistence): bump gorqlite to avoid..." | Re-trigger Greptile |
…results
Older gorqlite versions index results[0] in WriteOne/WriteOneParameterized
without a length check, so a write that returns HTTP 200 with an empty
results array panics the process ("index out of range [0] with length 0")
instead of returning an error. This can crash kotsadm on startup migrations
and on app-status writes when rqlite returns an empty-but-successful result.
Bump gorqlite to a revision whose result handling guards the empty case, and
bump schemahero to a compatible release. gorqlite's Open now returns a
*Connection, so adjust MustGetDBSession and the rqlite migration test to match.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
d810f92 to
9379b93
Compare
|
Reviews (2): Last reviewed commit: "fix(persistence): bump gorqlite to avoid..." | Re-trigger Greptile |
|
Flagging a blocker on this bump before it goes further, since the fix is not a clean version bump. The coupling. The empty-result guard we want only exists on gorqlite revisions that also changed The wall. The only schemahero releases built against the new gorqlite API are v0.23.0+, and those moved the database drivers to a plugin architecture ( So there is no schemahero version that is both compatible with the fixed gorqlite and usable in-process:
Options I can see:
I do not want to force the version bump given the plugin dependency, so converting to a discussion of direction. Happy to take whichever route the maintainers prefer. For context, the underlying behavior is the panic described above: an rqlite write that returns HTTP 200 with an empty |
|
Shortcut: [sc-139123] |
|
For future travellers PR: rqlite/gorqlite#62 |
Summary
Bumps the vendored gorqlite client so a successful-but-empty write result no longer panics kotsadm, and bumps schemahero to a compatible release.
Problem
[sc-139123]
Older gorqlite versions read the first element of the write-results slice without checking that the slice is non-empty. When rqlite answers a write with HTTP 200 and an empty
resultsarray, gorqlite panics:KOTS issues writes during startup migrations (
migrateSkippedPreflights) and from the app-status monitor (SetAppStatus), so this can crash kotsadm and leave it in CrashLoopBackOff whenever rqlite returns that empty-but-successful response, for example when the embedded rqlite cluster is in a degraded state.Fix
github.com/rqlite/gorqliteto a revision whose result handling guards the empty case (it returns an empty result rather than indexing out of range).github.com/schemahero/schemaheroto a release compatible with that gorqlite revision.Opennow returns a*Connection, soMustGetDBSessionis adjusted to match.Testing
go build ./cmd/...and the gorqlite-importing packages (pkg/persistence,pkg/store,pkg/tasks,pkg/app,pkg/filestore,pkg/version) compile cleanly.migrateSkippedPreflightswrite at an endpoint returning200 {"results":[]}, then confirmed the bumped gorqlite returns a result and does not panic under the same scenario.