Wait for the backend's destroy before the process exits (needs libtacky#7) #17
Closed
asxpi
wants to merge 0 commits from
asxpi/anotherim-js:fix/quit-waits-for-backend into develop
pull from: asxpi/anotherim-js:fix/quit-waits-for-backend
merge into: another-im:develop
another-im:develop
another-im:fix/relock-dismiss
another-im:fix/settings-accounts
another-im:feat/unified-dialogs-1
another-im:feat/unified-dialogs-2
another-im:feat/unified-dialogs-3
another-im:feat/one-status
another-im:macos-0.6.1
another-im:fix/console-tab-out
another-im:fix/desktop-drop
another-im:fix/xml-console-menu
another-im:feat/telegram-connect
another-im:feat/chat-tags
another-im:feat/muc-omemo
another-im:integrate/origin-develop-2026-10-02
another-im:fix/media-bubble-size
another-im:fix/empty-click-focus
another-im:feat/system-font-default
another-im:integrate/develop-2026-10-02
another-im:fix/attachment-decrypt
another-im:feat/system-font
another-im:fix/chat-links
another-im:fix/android-background-network
another-im:feat/tray
another-im:feat/thumb-cache
another-im:fix/android-csi-native
another-im:feat/opfs-store
another-im:fix/alttab-focus
another-im:try/groupcalls
another-im:feat/pwa-install
another-im:integrate/0.3.0
another-im:fix/upload-bubble-030
another-im:feat/drag-select
another-im:fix/upload-bubble
another-im:feat/encryption-info
another-im:chore/libtacky-path
another-im:feat/chat-header-menus
another-im:integrate/develop
another-im:fix/saved-top-linux-voice
another-im:fix/dialog-close-icons
another-im:feat/window-title-unread
another-im:feat/groupcalls
another-im:fix/open-picture-one-tap
another-im:feat/server-info-console
another-im:fix/chat-open-scroll-end
another-im:fix/desktop-push-mutes
another-im:fix/android-mute-push-selection
another-im:feat/otr-lock-colours
another-im:otr-v3-secret-chats
another-im:chore/remove-otr
another-im:feat/room-invites
another-im:feat/voice-video-messages
another-im:docs/readme
another-im:fix/android-empty-files
another-im:api-freeze
another-im:feat/push-counts
another-im:feat/h264-android-save
another-im:feat/keep-attachments-decrypted
another-im:feat/media-player
another-im:feat/fix-subdomain-attachments
another-im:feat/fonts-pt-sans
another-im:feat/always-decrypt-on-the-fly
another-im:feat/default-scale-125
another-im:fix/composer-focus-after-send
another-im:feat/android-native-calls
another-im:feat/media-stream-decrypt
another-im:feat/download-failure
another-im:feat/outbox-cap
another-im:feat/web-call-sheet
another-im:feat/first-run-push-check
another-im:feat/font-size-110
another-im:feat/log-view
another-im:fix/failed-transfer-history
another-im:feat/secure-unlock
another-im:feat/tpm-desktop
another-im:feat/tpm-android
another-im:feat/api-freeze-client
No reviewers
Labels
Clear labels
bug
Something is not working
duplicate
This issue or pull request already exists
feature request
New feature
linux
linux exclusive
macos
macos exclusive
needsinfo
Needs more information
severity: high
Major issue, significantly impacts usability or blocks core functionality
severity: low
Minor issue, cosmetic or rarely affects usage
severity: medium
Noticeable issue, but there is a workaround or limited impact
telegram_gw
issues related to the telegram gw
ui/ux
issues related to the interface and user experience (visual glitches, layout, interactions, usability problems)
windows
windows exclusive
wontfix
This won't be fixed
No labels
bug
duplicate
feature request
linux
macos
needsinfo
severity: high
severity: low
severity: medium
telegram_gw
ui/ux
windows
wontfix
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
another-im/anotherim-js!17
Loading…
Reference in a new issue
No description provided.
Delete branch "asxpi/anotherim-js:fix/quit-waits-for-backend"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Depends on libtacky#7. The
libtackysubmodule points at that PR's commit,5fc35e36, which is only inasxpi/libtackyuntil #7 is merged. Point it at the merge commit before merging this.The bug. The desktop app (0.5.4 to 0.5.7, Flatpak) segfaults every time it quits. Closing the window hangs for ~15 s while systemd writes the core dump, and the backend's last store transaction may be lost. Symbolized with the app's debug extension and
org.gnome.Sdk.Debug//50:Why.
stop_backend(onRunEvent::Exit) drops the backend, which istacky_destroy. That waits two seconds and returns whatever the destroy is doing. With three accounts the destroy is still running when it returns: they shut down one after another, and the stop waits for a request in flight. Tauri then callsprocess::exit(), and the backend's commit dies under the exit handlers. The same frame appears at every quit in every build I ran today.The change.
lib.rsbinds libtacky's newtacky_destroy_waitand addsTacky::destroy_waiting(self, max_ms). It's the destroyDropdoes, with the host's bound, and frees the sink afterwards in the same way.stop_backenduses it with 10 s (QUIT_WAIT_MS), so a wedged backend still can't hold the quit for good.stop_backendruns onRunEvent::Exit, when the windows are already gone, and before the push-started path'sexit(0).headless.rs) keepstacky_destroy, because its process doesn't exit after it.Checked in a local Flatpak build of 0.5.7 with this change and libtacky
5fc35e36on GNOME 50 (Wayland), with three accounts: quitting leaves no core dump, where every quit before did. libtacky'smake test-embed-hostcovers the new call (see #7).🤖 Generated with Claude Code
The desktop app segfaulted every time it quit, hanging ~15 s while the core was written. stop_backend dropped the backend on RunEvent::Exit, and tacky_destroy returns after two seconds whatever the destroy is doing; with three accounts it was still running, Tauri called process::exit(), and its last store commit crashed in SQLCipher under the exit handlers: BackendThread -> StopEventProc -> DbTransPostCmd -> sqlite3_exec -> walWriteOneFrame -> sqlite3Codec SIGSEGV main: tao event loop -> std::process::exit -> __run_exit_handlers stop_backend now stops it with tacky_destroy_wait (libtacky PR #7, which the submodule points at) through Tacky::destroy_waiting, bounded at 10 s so a wedged backend cannot hold the quit for good. It runs on RunEvent::Exit, when the windows are gone, and before the push-started path's exit. Android's headless push worker keeps tacky_destroy: its process does not exit after it. Checked in a Flatpak build of 0.5.7 with this and libtacky 5fc35e36: quitting leaves no core dump, where every quit did before. Assisted-by: Claude:opus-5-5Merged into develop by hand as
1dedead0(2026-10-16), with the libtacky submodule pointed at v1.0.0-rc7 (b40975d6), the tag that carries libtacky PR #7 merged, plus its review's fix: Reap had counted each wake-up as 100 ms and every emit woke it, so tacky_destroy's two seconds were really about twenty emits, which is what let a three-account destroy outrun it (the story in the description needs no slow destroy or request in flight); the bound is a clock deadline now. Your 10 s bound and destroy_waiting are kept as they are. Ships in 0.5.8. Thank you.Pull request closed