Skip to content

Tor rewrites its state file every few seconds because AvoidDiskWrites is not set #4445

Backlog

Description

@pithead-developer

What's the problem

build/tor/torrc.template has no AvoidDiskWrites line, so Tor writes its state file to disk very often.

What it impacts

Anyone running the stack on flash or small SSD storage. On a DIY test server (12 threads, remote-node mode, no rigs connected) the Tor container wrote 1.2 to 1.5 GB a day.
Constant wear for no benefit.
Unknown: how much of the volume is the state file versus other Tor files; the option's effect on this stack was not measured.

How I found it

Measured on that test server: the 14.5 KB state file had 7 different write times in 20 seconds.
grep AvoidDiskWrites across build/ and docker-compose.yml finds nothing on current develop.

Code references are from develop at 32d9834a. Checked for an existing issue: none found.

How important is it

Performance: a one-line change against steady disk wear on the exact hardware the project targets.

Acceptance criteria

  • build/tor/torrc.template contains AvoidDiskWrites 1, and a stack test asserts it in the rendered config.
  • Repeating the 20 second state-file check on the same kind of server shows fewer distinct write times.
  • Tor still bootstraps and keeps its onion keys across a restart.

Possible solutions

  • Smallest: add AvoidDiskWrites 1 to the template.
  • Alternative: also put Tor's cache files on a memory-backed mount, keeping the keys on disk.

Activity

  1. added this to the v2.0.5 milestone on Nov 24, 2026
  2. added
    performance
    on Nov 24, 2026
  3. added
    operator-hold
    and removed
    operator-hold
    on Nov 24, 2026
  4. pithead-developer commented on Nov 27, 2026

    @pithead-developer
    ContributorAuthor

    Blocked on #4502. Blocked on pithead#4502. tier4-e2e jobs 1099 and 1110 (phases lifecycle,rotate-onion, head 4bb57b8) failed the same 5 rows twice. The first failure is the backup restore round-trip. Its restore.log (artifact results/lifecycle-restore/restore.log of job 1110) says "This backup's configuration was written by pithead 2.0.4; this machine runs 2.0.3". That is the develop-v2.0.5 VERSION mismatch that #4502 covers. The other four failures follow from it: the dashboard had no rows, the encrypted restore did not start the stack, the onion fixture was refused, and the original config could not be restored. The 238 passing rows include the Tor rows, and none of the failures concern Tor config or startup. Finished: the one-line AvoidDiskWrites 1 template change, its test assertion, tiers 1-3 green on this head, and a PR comment explaining the block. Still needed: once #4502 closes, bring the base in, resubmit tier4-e2e (lifecycle,rotate-onion), paste the evidence block, and correct the PR body's unverified tor --verify-config claim.

    The runner resumes this issue when that one closes.

  5. added
    blocked
    on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedperformance

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions