superfly/litefs

Avoid FUSE for SHM writes

Closed this issue · 0 comments

The shared memory (SHM) file is memory-mapped and this causes odd interactions with the FUSE file system. When LiteFS writes to the file internally and invalidates it, the application layer flushes it old data back down which causes the data to get overwritten. To solve for this, we have locked SHM file. However, under load, this can cause SHM writes to get missed.

As a solution, we should only write changes to the SHM file through the FUSE file system and never internally. This will keep the state in-sync with the OS and the application process without any race conditions.