After update to gatsby v2.20.16 while running development environment
(and also when building production code) a following warnings are printed
to the console:
warn Error persisting state: EXDEV: cross-device link not permitted, rename '/tmp/reduxcacheYQgXl6' -> '~/bug-repro/.cache/redux'
warn Error persisting state: EXDEV: cross-device link not permitted, rename '/tmp/reduxcacheyUMf1i' -> '~/bug-repro/.cache/redux'
warn Error persisting state: EXDEV: cross-device link not permitted, rename '/tmp/reduxcacheYwlYQe' -> '~/bug-repro/.cache/redux'
This is probably caused by recently introduced fix to #22959.
Check-out gatsby-starter-hello-world, update gatsby to version 2.20.16 and run project:
$ npx gatsby new bug-repro https://github.com/gatsbyjs/gatsby-starter-hello-world
$ cd bug-repro
$ npm i [email protected]
$ npm start
Regular gatsby messages ended with success and dev server listening:
success Building development bundle - 14.247s
success open and validate gatsby-configs - 0.043s
success load plugins - 0.034s
--- cut ---
success run queries - 0.091s - 2/2 21.91/s
warn Error persisting state: EXDEV: cross-device link not permitted, rename '/tmp/reduxcacheqOMD9C' -> '~/bug-repro/.cache/redux'
warn Error persisting state: EXDEV: cross-device link not permitted, rename '/tmp/reduxcacheWCin2r' -> '~/bug-repro/.cache/redux'
warn Error persisting state: EXDEV: cross-device link not permitted, rename '/tmp/reduxcacheWKdflr' -> '~/bug-repro/.cache/redux'
warn Error persisting state: EXDEV: cross-device link not permitted, rename '/tmp/reduxcachewQN2iO' -> '~/bug-repro/.cache/redux'
...
New lines with this warning are showing up approx. every second. System /tmp folder is populated with directories like
reduxcachew9mMGw, reduxcachewafKs4 reduxcacheyUMf1i ...
Info:
$ npx gatsby info
System:
OS: Linux 5.5 Fedora 30 (Workstation Edition) 30 (Workstation Edition)
CPU: (8) x64 Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz
Shell: 5.0.11 - /bin/bash
Binaries:
Node: 10.19.0 - /usr/bin/node
npm: 6.13.4 - /usr/bin/npm
Languages:
Python: 2.7.17 - /usr/bin/python
Browsers:
Firefox: 74.0.1
npmPackages:
gatsby: ^2.20.16 => 2.20.16
Kernel:
$ uname -r
5.5.10-100.fc30.x86_64
System tmp directory:
$ mount | grep /tmp
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
System partition (with home directory):
$ mount | grep " / "
/dev/mapper/space-system on / type ext4 (rw,relatime)
Gatsby version:
$ npx gatsby --version
Gatsby CLI version: 2.11.6
Gatsby version: 2.20.16
Same issue here ✋
Tinkering with it right now - it seems that reverting change introduced here:
https://github.com/gatsbyjs/gatsby/pull/22959/commits/e51ffd9e9848e0034cfc9fd05dbb7f30388ae6d5
fixes the problem.
OK, In order not to revert the #22959 fix (and have the cache directory in the system /tmp directory) it seem that in the persist.ts file, instead using renameSync(), a moveSync() from fs-extra could be used.
There (in the moveSync()), fs.renameSync() is invoked and if it throws EXDEV then moveAcrossDevice() is invoked (consisting of copySync() followed by a removeSync()).
Reference: move-sync.js.
Testing the change locally.
Oh hm, I'll look into it and the PR that was opened. Thanks for reporting it :)
Most helpful comment
Same issue here ✋