Skip to content

RangeError: Map maximum size exceeded - 2^24 file limit? #614

@edtan-caseware

Description

@edtan-caseware

Hi, I have a long-running process using glob, and over time, it scans through lots of files. Eventually, we get the following error:

/home/ed/node_modules/path-scurry/dist/commonjs/index.js:108
    normalizeCache.set(s, n);
                   ^

RangeError: Map maximum size exceeded
    at Map.set (<anonymous>)
    at normalize (/home/ed/node_modules/path-scurry/dist/commonjs/index.js:108:20)
    at new PathBase (/home/ed/node_modules/path-scurry/dist/commonjs/index.js:319:60)
    at new PathPosix (/home/ed/node_modules/path-scurry/dist/commonjs/index.js:1264:9)
    at PathPosix.newChild (/home/ed/node_modules/path-scurry/dist/commonjs/index.js:1282:16)
    at #readdirAddNewChild (/home/ed/node_modules/path-scurry/dist/commonjs/index.js:842:28)
    at #readdirAddChild (/home/ed/node_modules/path-scurry/dist/commonjs/index.js:837:37)
    at /home/ed/node_modules/path-scurry/dist/commonjs/index.js:1006:42
    at node:fs:187:23
    at node:internal/util:519:12
    at getDirents (node:internal/fs/utils:286:7)
    at req.oncomplete (node:fs:1479:7)

It looks like this is happening because of this global normalizeCache variable: https://github.com/isaacs/path-scurry/blob/main/src/index.ts#L177, which never gets cleared. Is there a way that the cache can be cleared?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions