KOReader plugin: readest_sync_*.json response files pile up in the settings folder (one set per exit)
Bug Description
The KOReader plugin leaves readest_sync_<time>_<seq>.json files behind in KOReader's settings folder (koreader/settings/). On my Kindle 19 of them accumulated in four days, in six sets of 3–4 files, and every set was created one second before KOReader exited:
readest_sync_1790194202_102..105.json 2026-09-23 22:10:02 KOReader exit 22:10:03
readest_sync_1790265223_37..40.json 2026-09-24 17:53:43 exit 17:53:44
readest_sync_1790353010_5..7.json 2026-09-25 18:16:50 exit 18:16:51
readest_sync_1790356940_18..20.json 2026-09-25 19:22:20 exit 19:22:21
readest_sync_1790413683_5..7.json 2026-09-26 11:08:03 exit 11:08:04
readest_sync_1790415249_5..6.json 2026-09-26 11:34:09 exit 11:34:10Cause, in apps/readest.koplugin/readest_syncclient.lua (unchanged on main): _dispatchInSubprocess() creates the response file (L106–110) before forking, and removes it only inside the poll callback (L154) that runs after the child finishes. The sync that runs when the book closes / KOReader exits dispatches its requests just before the UI loop is torn down, so poll never runs for them: the child still writes its response, and nothing deletes the file.
The files hold the sync responses (note text, user id) next to the access token that already lives in that folder, so this is clutter rather than a leak, but it grows by a few files with every exit.
Possible fixes: remove stale readest_sync_*.json files when the plugin initialises (nothing can be in flight then), and/or keep the pending paths and remove them in onExit/onCloseWidget after terminating any child still running.
Steps to Reproduce
- Log in to Readest sync in the KOReader plugin, with auto sync on.
- Open a book, turn a page, then exit (or restart) KOReader.
- Look in
koreader/settings/: newreadest_sync_<time>_<n>.jsonfiles from the exit sync are still there. - Repeat: one more set per exit.
Expected Behavior
Response files are deleted after use, or at the latest on the next start.
Operating System
Kindle (KOReader plugin)
OS Version
Kindle Colorsoft, KOReader nightly v2026.07.2-188 (kindlehf)
Readest Version
KOReader plugin 0.12.10
Source: readest/readest