Repository navigation
Labs: fix the crash on disconnect, switch without flicker, report crashes - #262
Merged
Merged
Conversation
…shes Closing a set-aside pool from park_connection, resume_connection or close_parked called tokio::spawn. Those are sync commands with no Tokio runtime, so it panicked, and release builds abort on a panic: turning Labs off, editing a connection or disconnecting with databases kept open closed the app. close_in_background now spawns on tauri's runtime, with a test that fails on the old code. Crashes now leave a report: a panic hook writes the message, location, version and platform to the data directory before the abort, and the next launch opens the report dialog prefilled as a crash report. Switching to a database not open yet keeps the current one on screen (its calls still reach its parked pool) and swaps once the new one is connected: no blank layout, no full-screen overlay. The status bar says what is opening. A failed switch puts the previous database back in place. Connecting no longer wipes the row and result caches of tabs kept for other databases, so a resumed grid gets its raw rows back instead of the proxied copy, which was slow to scroll. Tab bar: no database labels. Other databases' tabs are dimmed, each group starts with a divider, and the tooltip names the database. They also show in a single pane, where they were missing. The status bar lists the open databases; click one to switch. Disconnecting with others open closes only this one and moves to the last used.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
park_connection,resume_connectionandclose_parkedare sync commands, which run with no Tokio runtime. Closing a pool there calledtokio::spawn, which panics outside a runtime, and release builds usepanic = "abort". Turning Labs off, editing a connection, or disconnecting with databases kept open closed the app without a word. D1 too, since the spawn ran for every engine.connection = nullfirst (the whole layout dropped), raised the full-screen Connecting overlay, then rebuilt an empty sidebar.onConnectedwiped every tab's row cache, including tabs kept for the other databases. Coming back, the grid got the proxied$statecopy of its rows, the known slow-scroll path.What changed
close_in_backgroundspawns on tauri's runtime. New testclosing_a_pool_outside_a_runtime_does_not_panic: fails on the old code (panics), passes now.crash.rsinstalls a panic hook that writes message, location, thread, version, platform and backtrace tolast-crash.jsonbefore the abort (the OS crash reporter still sees it). The next launch takes it once and opens the report dialog as "Stroke quit unexpectedly", prefilled as a crash report, with Open on GitHub.Checked
cargo test(crash + parked),vitest1798 passed,svelte-check0 errors,npm run build.