Skip to content

Conversation

@kim
Copy link
Contributor

@kim kim commented Mar 14, 2025

For some reason, we've been opening the read-only index file with
.read(true).append(true).

This translates to O_RDWR | O_APPEND on *nix, but something weird on
Windows. A shared memory map requires O_RDWR (or equivalent) on either
platform, though, meaning that we'd always fail to mmap the index on
Windows.

Open with .read(true).write(true) instead to fix.

Expected complexity level and risk

1

The impact of this bug is also small, because the offset index is not crucial
for standalone use. Who says, though, that Windows will never become a viable
server platform for SpacetimeDB?

Testing

Extends the tests to open an index using all three variants and perform lookups.

For some reason, we've been opening the read-only index file with
`.read(true).append(true)`.

This translates to `O_RDWR | O_APPEND` on *nix, but something weird on
Windows. A shared memory map requires `O_RDWR` (or equivalent) on either
platform, though, meaning that we'd always fail to `mmap` the index on
Windows.

Open with `.read(true).write(true)` instead to fix.
@kim kim requested a review from Shubham8287 March 14, 2025 12:01
@bfops bfops added the release-any To be landed in any release window label Mar 17, 2025
Copy link
Contributor

@Shubham8287 Shubham8287 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows is always hard.

@kim kim added this pull request to the merge queue Mar 19, 2025
Merged via the queue into master with commit 434c280 Mar 19, 2025
15 checks passed
@kim kim deleted the kim/commitlog/fix-index-open-flags branch March 19, 2025 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-any To be landed in any release window

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants