Skip to content

FileSystemInfo can not createSnapshot with symbol link #12246

Closed

Description

@killagu

Bug report

What is the current behavior?
I install deps with npminstall(it can install faster), but the file tree in node_modules is special bacause npminstall install pkgs with symbol link to download and write less files.

The file tree looks like this

app
├── index.js
└── node_modules
    ├── [email protected]@a(real dir)
    |   ├── index.js
    |   └── node_modules
    |       └── b(symbol link to app/node_modules/[email protected]@b)
    ├── [email protected]@b(real dir)
    |   ├── index.js
    |   └── node_modules
    |       └── a(symbol link to app/node_modules/[email protected]@a)
    ├── a(symbol link to app/node_modules/[email protected]@a)
    └── b(symbol link to app/node_modules/[email protected]@b)

Because of a,b is reference by each other, contextTimestampQueue and contextHashQueue in FileSystemInfo will never reach the end.

If the current behavior is a bug, please provide the steps to reproduce.

The minimal reproduction repo is here.
The reproduce step is

git clone [email protected]:killagu/npminstall_webpack.git
cd npminstall_webpack
npm i -g cnpm
# must use cnpm install
cnpm i
npm run build

Build snapshow will fail.

What is the expected behavior?

  • Use fs.lstat to get file info, and use target path to process.
  • Skip files if has been processed

Other relevant information:

webpack version: 5.11.0
Node.js version: 12.16.3
Operating System: macOS Big Sur 11.0.1 (20B29)

If it is ok, I'm happy to make a pr to fix it.

Activity

  1. added
    webpack-5
    on Dec 21, 2020
  2. alexander-akait commented on Dec 21, 2020

    @alexander-akait
    Member

    Yep bug

  3. killagu commented on Dec 21, 2020

    @killagu
    Author

    @alexander-akait Thanks for confirm, I can have a try to fix it.

  4. alexander-akait commented on Jan 25, 2021

    @alexander-akait
    Member

    Other example of the problem with symlinks #12503 (comment)

  5. alexander-akait commented on Mar 5, 2021

    @alexander-akait
    Member

    Another example #12810

  6. webpack-bot commented on Jun 4, 2021

    @webpack-bot
    Contributor

    This issue had no activity for at least three months.

    It's subject to automatic issue closing if there is no activity in the next 15 days.

  7. added
    status: stale
    on Jun 4, 2021
  8. alexander-akait commented on Jun 4, 2021

    @alexander-akait
    Member

    bump

  9. removed
    status: stale
    on Jun 4, 2021
  10. iperzic commented on Jul 23, 2021

    @iperzic

    Do we have an ETA on when this might be fixed?

  11. alexander-akait commented on Aug 18, 2021

    @alexander-akait
    Member
  12. qiqiboy commented on Sep 9, 2021

    @qiqiboy

    Hi @sokra, I found that some specific libs will still cause the snapshot to fail in v5.52.0, such as video.js. Install video.js in the above reproduction repo, and it can be reproduced after running.

    git clone [email protected]:killagu/npminstall_webpack.git
    cd npminstall_webpack
    npm i -g cnpm
    # must use cnpm install
    cnpm i
    # NEW: install the video.js library
    cnpm install video.js -S
    npm run build
    
    <--- JS stacktrace --->
    
    FATAL ERROR: invalid array length Allocation failed - JavaScript heap out of memory
  13. alexander-akait commented on Sep 9, 2021

    @alexander-akait
    Member

    @qiqiboy update wepback to the latest stable version

  14. qiqiboy commented on Sep 9, 2021

    @qiqiboy

    @qiqiboy update wepback to the latest stable version

    Yes, I have tried, but still fail.

    cnpm install video.js webpack@latest -S
    npm run build
  15. alexander-akait commented on Sep 9, 2021

    @alexander-akait
    Member

    Can't reproduce the problem

  16. qiqiboy commented on Sep 9, 2021

    @qiqiboy

    @alexander-akait my env info:

    $ cnpm -v                                
    [email protected] (/usr/local/lib/node_modules/cnpm/lib/parse_argv.js)
    [email protected] (/usr/local/lib/node_modules/cnpm/node_modules/npm/lib/npm.js)
    [email protected] (/usr/local/bin/node)
    [email protected] (/usr/local/lib/node_modules/cnpm/node_modules/npminstall/lib/index.js)
    prefix=/usr/local 
    darwin x64 20.3.0 
    registry=https://registry.nlark.com

    截屏2021-09-09 20 33 42

  17. alexander-akait commented on Sep 9, 2021

    @alexander-akait
    Member

    Increase your memory usage, file is so bug, not related to this problem

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

    webpack-5

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions