Skip to content

fix(desktop): disable AOF on Windows to prevent cygwin redis fork crash - #1170

Open
kaverjody wants to merge 1 commit into
zts212653:mainfrom
kaverjody:fix/windows-redis-disable-aof
Open

fix(desktop): disable AOF on Windows to prevent cygwin redis fork crash#1170
kaverjody wants to merge 1 commit into
zts212653:mainfrom
kaverjody:fix/windows-redis-disable-aof

Conversation

@kaverjody

Copy link
Copy Markdown

Fixes #1169.

Problem

desktop/service-manager.js starts redis with --appendonly yes unconditionally. On Windows the bundled redis is a cygwin build whose fork() emulation is unreliable, so the AOF background rewrite crashes the redis child. Because Redis prefers the appendonly file over dump.rdb when AOF is enabled, a crashed/empty appendonly file can overwrite dump.rdb on the next start -- total session history loss. See issue #1169 for full root-cause + reproduction.

Fix

Gate AOF by platform:

'--appendonly', IS_WIN ? 'no' : 'yes',
  • Windows: --appendonly no -> relies on RDB (--save 60 1), no fork crash, dump.rdb loads correctly. Ample durability for desktop single-user.
  • macOS: --appendonly yes retained -> native redis fork() works, AOF durability preserved.

IS_WIN already defined at the top of the file.

Verification

  • Ubuntu -> Windows desktop migration: with --appendonly no, redis loads the restored dump.rdb (DBSIZE 3678) intact, no crash, history preserved across app restarts.
  • AOF background rewrite no longer fires on Windows (no fork), eliminating the crash path.

[宪宪/布偶猫/glm-latest🐾]

The bundled Windows portable redis is a cygwin build whose fork()
emulation is unreliable. With --appendonly yes, Redis triggers an
AOF background rewrite that forks a child; on cygwin this crashes
and can leave an empty appendonly file that overwrites dump.rdb on
the next start, wiping all session history.

Root-caused during an Ubuntu->Windows desktop migration: after
restoring dump.rdb (DBSIZE 3678), the first app launch with AOF
enabled crashed the redis child and history disappeared. Switching
to --appendonly no loaded dump.rdb correctly (3678 keys intact).

Fix: gate AOF by platform. Windows keeps RDB (--save 60 1, ample
for desktop single-user); macOS retains AOF (native fork works).

[宪宪/布偶猫/glm-latest🐾]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[desktop] Windows bundled redis crashes on AOF rewrite, risking dump.rdb data loss

1 participant