tink: Running w/o a package-lock results in maximum call stack exceeded

tish index.js in a directory with a package.json that has a dep, but no package-lock results in:

tink ERR! prepare RangeError: Maximum call stack size exceeded
tink ERR! prepare     at Object.resolve (/Users/rebecca/code/tink/lib/pkglock.js:23:25)
tink ERR! prepare     at Object.openSync (/Users/rebecca/code/tink/lib/node/fs.js:493:32)
tink ERR! prepare     at readFileSync (fs.js:348:35)
tink ERR! prepare     at readPkgLock (/Users/rebecca/code/tink/lib/pkglock.js:147:71)
tink ERR! prepare     at Object.resolve (/Users/rebecca/code/tink/lib/pkglock.js:28:18)
tink ERR! prepare     at Object.openSync (/Users/rebecca/code/tink/lib/node/fs.js:493:32)
tink ERR! prepare     at readFileSync (fs.js:348:35)
tink ERR! prepare     at readPkgLock (/Users/rebecca/code/tink/lib/pkglock.js:147:71)
tink ERR! prepare     at Object.resolve (/Users/rebecca/code/tink/lib/pkglock.js:28:18)
tink ERR! prepare     at Object.openSync (/Users/rebecca/code/tink/lib/node/fs.js:493:32)
tink ERR! prepare     at readFileSync (fs.js:348:35)
tink ERR! prepare     at readPkgLock (/Users/rebecca/code/tink/lib/pkglock.js:147:71)
tink ERR! prepare     at Object.resolve (/Users/rebecca/code/tink/lib/pkglock.js:28:18)
tink ERR! prepare     at Object.openSync (/Users/rebecca/code/tink/lib/node/fs.js:493:32)
tink ERR! prepare     at readFileSync (fs.js:348:35)
tink ERR! prepare     at readPkgLock (/Users/rebecca/code/tink/lib/pkglock.js:147:71)
tink ERR! prepare  { RangeError: Maximum call stack size exceeded
tink ERR! prepare     at Object.resolve (/Users/rebecca/code/tink/lib/pkglock.js:23:25)
tink ERR! prepare     at Object.openSync (/Users/rebecca/code/tink/lib/node/fs.js:493:32)
tink ERR! prepare     at readFileSync (fs.js:348:35)
tink ERR! prepare     at readPkgLock (/Users/rebecca/code/tink/lib/pkglock.js:147:71)
tink ERR! prepare     at Object.resolve (/Users/rebecca/code/tink/lib/pkglock.js:28:18)
tink ERR! prepare     at Object.openSync (/Users/rebecca/code/tink/lib/node/fs.js:493:32)
tink ERR! prepare     at readFileSync (fs.js:348:35)
tink ERR! prepare     at readPkgLock (/Users/rebecca/code/tink/lib/pkglock.js:147:71)
tink ERR! prepare     at Object.resolve (/Users/rebecca/code/tink/lib/pkglock.js:28:18)
tink ERR! prepare     at Object.openSync (/Users/rebecca/code/tink/lib/node/fs.js:493:32)
tink ERR! prepare     at readFileSync (fs.js:348:35)
tink ERR! prepare     at readPkgLock (/Users/rebecca/code/tink/lib/pkglock.js:147:71)
tink ERR! prepare     at Object.resolve (/Users/rebecca/code/tink/lib/pkglock.js:28:18)
tink ERR! prepare     at Object.openSync (/Users/rebecca/code/tink/lib/node/fs.js:493:32)
tink ERR! prepare     at readFileSync (fs.js:348:35)
tink ERR! prepare     at readPkgLock (/Users/rebecca/code/tink/lib/pkglock.js:147:71)
tink ERR! prepare   stack:
tink ERR! prepare    'RangeError: Maximum call stack size exceeded\n    at Object.resolve (/Users/rebecca/code/tink/lib/pkglock.js:23:25)\n    at Object.openSync (/Users/rebecca/code/tink/lib/node/fs.js:493:32)\n    at readFileSync (fs.js:348:35)\n    at readPkgLock (/Users/rebecca/code/tink/lib/pkglock.js:147:71)\n    at Object.resolve (/Users/rebecca/code/tink/lib/pkglock.js:28:18)\n    at Object.openSync (/Users/rebecca/code/tink/lib/node/fs.js:493:32)\n    at readFileSync (fs.js:348:35)\n    at readPkgLock (/Users/rebecca/code/tink/lib/pkglock.js:147:71)\n    at Object.resolve (/Users/rebecca/code/tink/lib/pkglock.js:28:18)\n    at Object.openSync (/Users/rebecca/code/tink/lib/node/fs.js:493:32)\n    at readFileSync (fs.js:348:35)\n    at readPkgLock (/Users/rebecca/code/tink/lib/pkglock.js:147:71)\n    at Object.resolve (/Users/rebecca/code/tink/lib/pkglock.js:28:18)\n    at Object.openSync (/Users/rebecca/code/tink/lib/node/fs.js:493:32)\n    at readFileSync (fs.js:348:35)\n    at readPkgLock (/Users/rebecca/code/tink/lib/pkglock.js:147:71)' }

I couldn’t reproduce it at first, until I ran it with an older version (first before then after dc96890). I’m not really sure how the internals work, but running the current version with TINK_NO_PKG_LOCK=true once seems to make it work again.

My full repro (using current latest, 83e7070):

With env TINK_NO_PKG_LOCK=true tish index.js I get a package-lock, but the run still errors (and it errors even with a package-lock with that env var set).

1 Like

I kinda get where this is happening, but I’m not sure why the ordering is such that this gets triggered like that. I’d expect fs.readFileSync.orig to get used, but it’s not doing it for some reason. I’ll have to look into it a bit closer.

The fs.openSync call in fs.readFileSync.orig?

1 Like

aaaaaaa right. I’ll have a fix for this soon. Just gonna hack on this a bit…

1 Like

Fixed in https://github.com/npm/tink/commit/fa050624126a03eca4f943683a3b3717201ee39f, and I’ve released it as tink@0.21.5

1 Like

Now the same repro just hangs for me and tink stops responding to signals (eg, ctrl-c or kill -term).

It also still fails with TINK_NO_PKG_LOCK

what! dang. I’ll take a look at that now, I guess.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.