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

gatsby v2.20.16 causes warn Error persisting state: EXDEV: cross-device link not permitted, rename #22999

Closed
drmats opened this issue Apr 10, 2020 · 4 comments · Fixed by #23029
Assignees
Labels
type: bug An issue or pull request relating to a bug in Gatsby

Comments

@drmats
Copy link

drmats commented Apr 10, 2020

Description

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.

Steps to reproduce

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 gatsby@2.20.16
$ npm start

Expected result

Regular gatsby messages ended with success and dev server listening:

success Building development bundle - 14.247s

Actual result

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 ...

Environment

  • 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
    
@drmats drmats added the type: bug An issue or pull request relating to a bug in Gatsby label Apr 10, 2020
@glarivie
Copy link

Same issue here ✋

@drmats
Copy link
Author

drmats commented Apr 10, 2020

Tinkering with it right now - it seems that reverting change introduced here:
e51ffd9
fixes the problem.

@drmats
Copy link
Author

drmats commented Apr 10, 2020

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.

@pvdz
Copy link
Contributor

pvdz commented Apr 11, 2020

Oh hm, I'll look into it and the PR that was opened. Thanks for reporting it :)

jnylen added a commit to oddcamp/gatsby-starter-oddcamp that referenced this issue Apr 30, 2020
jnylen pushed a commit to oddcamp/gatsby-starter-oddcamp that referenced this issue Apr 30, 2020
* Add docker files

* Bump gatsby to 2.20.18 due to [this issue](gatsbyjs/gatsby#22999).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
3 participants