react / react/metro

concurrent builds fail due to shared use of /tmp/metro-cache/

Open
#331 18 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
5.6k
Forks
696
Avg merge
8m
Merged PRs (30d)
7

Description

Do you want to request a feature or report a bug?

bug

What is the current behavior?

Concurrently-running react-native builds often fail with e.g.:

ENOENT: no such file or directory, open '/tmp/metro-cache/03/2ed8513838f8bad0238a0a6032e415d1ea766f50f498e7d284ac6a05cb0b4000001234'

Error: ENOENT: no such file or directory, open '/tmp/metro-cache/03/2ed8513838f8bad0238a0a6032e415d1ea766f50f498e7d284ac6a05cb0b400001234'
    at Object.fs.openSync (fs.js:646:18)
    at Object.fs.writeFileSync (fs.js:1291:33)
    at FileStore.set (/Users/jenkins/src/node_modules/metro-cache/src/stores/FileStore.js:43:8)
    at Cache.set (/Users/jenkins/src/node_modules/metro-cache/src/Cache.js:96:31)
    at /Users/jenkins/src/node_modules/react-native/node_modules/metro/src/DeltaBundler/Transformer.js:127:13
    at Generator.next (<anonymous>)
    at step (/Users/jenkins/src/node_modules/react-native/node_modules/metro/src/DeltaBundler/Transformer.js:11:657)
    at /Users/jenkins/src/node_modules/react-native/node_modules/metro/src/DeltaBundler/Transformer.js:11:817
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install and yarn test.

What is the expected behavior?

I'd expect concurrently-running builds not to interfere with each other.

Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.

MacOS 10.13.3
node 8.9.4
npm 5.6.0
started seeing this when upgraded react-native from 0.55.4 to 0.57.2
=> (from our package-lock.json) metro went from 0.30.2 to 0.47.1

Contributor guide

Open the contributing guide

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 metro-cache/src/stores/FileStore.js and follow the Cache.js and DeltaBundler/Transformer.js stack frames shown in the report. Reproduce concurrent React Native builds using the reported shared /tmp/metro-cache/ path and inspect how cache files and directories are handled. Done means concurrent builds no longer interfere with or remove each other’s cache entries.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, react-native
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.