Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using /dev/shm on Linux #1338

Merged
merged 1 commit into from
Nov 20, 2020
Merged

Conversation

teor2345
Copy link
Contributor

Motivation

  1. Some systems have a very small /dev/shm.
    For example, docker's default /dev/shm size is 64 MB: Hit by size limit of /dev/shm docker-library/postgres#416
    And /dev/shm isn't really intended for applications to store arbitrary-sized temporary files. It's meant to be used as a file-based interface to shared memory for inter-process communication.

  2. We copied a bunch of complex code from sled, which we don't really need.
    (We also didn't credit the author, which is required under the MIT and Apache licenses.)

  3. To help users identify orphaned Zebra temporary directories, we should prefix them with "zebra", the state version, and the network.

Solution

  1. use the temporary directory on all operating systems, and use TempDir to generate the temporary path in the temporary directory
  2. delete the code that we copied from sled
  3. prefix the temporary path with the state version and network

The code in this pull request has:

  • Documentation Comments
  • Acceptance Tests

Review

@yaahc wrote this code.

This review is not urgent.

This bug could cause errors on long-running ephemeral tests in docker containers with the default /dev/shm size. But we're not seeing those errors yet.

Related Issues

This bug existed in sled, and we copied it across when we moved to RocksDB in #1325.

Some systems have a very small /dev/shm, for example, see:
docker-library/postgres#416

So we should just use the temporary directory on all operating systems.

Also:
* use TempDir to generate the temporary path
* delete the code that we copied from sled
* prefix the temporary path with the state version and network
@teor2345 teor2345 added C-bug Category: This is a bug A-rust Area: Updates to Rust code C-cleanup Category: This is a cleanup labels Nov 20, 2020
@teor2345 teor2345 added this to the First Alpha Release milestone Nov 20, 2020
@teor2345 teor2345 requested a review from yaahc November 20, 2020 01:28
@teor2345 teor2345 self-assigned this Nov 20, 2020
@teor2345 teor2345 merged commit ec00ee4 into ZcashFoundation:main Nov 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rust Area: Updates to Rust code C-bug Category: This is a bug C-cleanup Category: This is a cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants