Skip to content

fix(app): ignore file open events in the instance watcher - #7703

Open
lbellows wants to merge 1 commit into
modrinth:mainfrom
lbellows:fix/watcher-ignore-access-events
Open

lbellows wants to merge 1 commit into
modrinth:mainfrom
lbellows:fix/watcher-ignore-access-events

Conversation

@lbellows

Copy link
Copy Markdown
Contributor

Closes #7624

On Linux, notify's inotify backend watches IN_OPEN, and notify-debouncer-mini drops the event kind, so the watcher can't tell a read from a write. The app's own reads then look like changes: hashing jars during a content sync queues another content sync, and reading options.txt for the locale index queues another index pass. This wraps the watcher and drops Access(Open) events before they reach the debouncer. Modify, create, delete and close-write still come through.

Same notify 8.2.0 / debouncer-mini 0.7.0, a mods/ dir watched recursively, five reads of a jar, then one modify, one create and one delete:

RecommendedWatcher after reads: 1  after modify: 1  after create: 1  after delete: 1
ChangeWatcher      after reads: 0  after modify: 1  after create: 1  after delete: 1

inotify reports IN_OPEN for plain reads, and notify-debouncer-mini drops
the event kind, so the app reading its own instance files (hashing mods
during a content sync, parsing options.txt for the locale index) looked
like a change and queued another pass over the same files. Filter open
events out before they reach the debouncer.
@github-actions

Copy link
Copy Markdown
Contributor

Pull request changelog

App

Added

Changed

Deprecated

Removed

Fixed

Security

Website

Added

Changed

Deprecated

Removed

Fixed

Security

Hosting

Added

Changed

Deprecated

Removed

Fixed

Security

@lbellows

Copy link
Copy Markdown
Contributor Author

Measured on 0.21.6 (Flatpak, Linux Mint), two machines, app open, no game running, 3 min after launch.

#7561 is in 0.21.6 and instance_files is quiet now:

rows with modified_at in last 120s: 0

The launcher is still writing, all of it to app.db / app.db-wal:

write rate: 26870 KiB/s    cpu 218% (machine 1)
write rate: 17132 KiB/s    cpu 372% (machine 2)

A per-table content hash taken 60 s apart shows only store_blobs changing. Over 20 s, 1356 of its 1951 rows changed, and the only column that differed was last_used_at:

rows changed in 20s: 1356 of 1951; new 0 gone 0
   last_used_at: 1790720494 -> 1790720514
   last_used_at: 1790720494 -> 1790720514
   last_used_at: 1790720492 -> 1790720514

verified_at does not change, so this is mark_file_used from lookup_with_guard, called for each file on every content sync. The log shows the same loop: about 6 init_watcher ... World updated lines a second, while 0 to 1 level.dat files were actually modified in the last 10 minutes.

@Hallskii
Hallskii requested a review from IMB11 October 2, 2026 16:37

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Game-setting locale indexer re-runs itself once a second on Linux (inotify IN_OPEN feedback loop)

1 participant