racket / racket/web-server

`make-dir-store` is not atomic

Open
#135 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Racket
Stars
99
Forks
48
PR merge metrics
No merged PRs in 30d

Description

While looking at a Discourse thread, I noticed that make-dir-store uses (with-output-to-file #:exists 'replace ...):

https://github.com/racket/web-server/blob/87a1e58a9b92c621f7d96c76de1da39587f04140/web-server-lib/web-server/stuffers/store.rkt#L9-L13

It seems like it would be better to use call-with-atomic-output-file here: if somehow you ended up with a partially-written file, it seems like it would be very painful to debug.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with web-server-lib/web-server/stuffers/store.rkt, especially make-dir-store at the linked lines, and read how it currently writes the store file. Compare that path with call-with-atomic-output-file and verify that a write leaves either the previous complete file or a new complete file, not a partially written one.

Written by the indexing model from the issue text.

Assessment

Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.