replicache
replicache copied to clipboard
Recursion / infinite loop bug in "delete"
Encountering the below in prod:
RangeError: Maximum call stack size exceeded
at ? (./node_modules/replicache/out/replicache.mjs:1:49086)
at Array.forEach(<anonymous>)
at delete(./node_modules/replicache/out/replicache.mjs:1:49078)
at ? (./node_modules/replicache/out/replicache.mjs:1:49188)
at Array.forEach(<anonymous>)
at delete(./node_modules/replicache/out/replicache.mjs:1:49078)
at ? (./node_modules/replicache/out/replicache.mjs:1:49188)
at Array.forEach(<anonymous>)
at delete(./node_modules/replicache/out/replicache.mjs:1:49078)
at ? (./node_modules/replicache/out/replicache.mjs:1:49188)
at Array.forEach(<anonymous>)
at delete(./node_modules/replicache/out/replicache.mjs:1:49078)
at ? (./node_modules/replicache/out/replicache.mjs:1:49188)
at Array.forEach(<anonymous>)
at delete(./node_modules/replicache/out/replicache.mjs:1:49078)
at ? (./node_modules/replicache/out/replicache.mjs:1:49188)
at Array.forEach(<anonymous>)
at delete(./node_modules/replicache/out/replicache.mjs:1:49078)
at ? (./node_modules/replicache/out/replicache.mjs:1:49188)
at Array.forEach(<anonymous>)
at delete(./node_modules/replicache/out/replicache.mjs:1:49078)
at ? (./node_modules/replicache/out/replicache.mjs:1:49188)
at Array.forEach(<anonymous>)
at delete(./node_modules/replicache/out/replicache.mjs:1:49078)
at ? (./node_modules/replicache/out/replicache.mjs:1:49188)
at Array.forEach(<anonymous>)
at delete(./node_modules/replicache/out/replicache.mjs:1:49078)
at ? (./node_modules/replicache/out/replicache.mjs:1:49188)
at Array.forEach(<anonymous>)
at delete(./node_modules/replicache/out/replicache.mjs:1:49078)
at ? (./node_modules/replicache/out/replicache.mjs:1:49188)
at Array.forEach(<anonymous>)
at delete(./node_modules/replicache/out/replicache.mjs:1:49078)
at ? (./node_modules/replicache/out/replicache.mjs:1:49188)
at Array.forEach(<anonymous>)
at delete(./node_modules/replicache/out/replicache.mjs:1:49078)
at ? (./node_modules/replicache/out/replicache.mjs:1:49188)
at Array.forEach(<anonymous>)
at delete(./node_modules/replicache/out/replicache.mjs:1:49078)
at ? (./node_modules/replicache/out/replicache.mjs:1:49188)
at Array.forEach(<anonymous>)
at delete(./node_modules/replicache/out/replicache.mjs:1:49078)
at ? (./node_modules/replicache/out/replicache.mjs:1:49188)
at Array.forEach(<anonymous>)
at delete(./node_modules/replicache/out/replicache.mjs:1:49078)
at ? (./node_modules/replicache/out/replicache.mjs:1:49188)
at Array.forEach(<anonymous>)
at delete(./node_modules/replicache/out/replicache.mjs:1:49078)
at ? (./node_modules/replicache/out/replicache.mjs:1:49188)
at Array.forEach(<anonymous>)
It looks like there's some recursive code that isn't finding an end condition here.
Thank you for the report. This looks concerning. @arv is going to look into it soon.
@tmcw Which version is this?
Assuming v10.0.0-beta.0 I get:
npx stacktracify out/replicache.mjs.map
RangeError: Maximum call stack size exceeded
at (../src/dag/lazy-store.ts:489:34)
at Array.forEach
at (../src/dag/lazy-store.ts:489:26)
at (../src/dag/lazy-store.ts:498:15)
at Array.forEach
at (../src/dag/lazy-store.ts:489:26)
at (../src/dag/lazy-store.ts:498:15)
at Array.forEach
at (../src/dag/lazy-store.ts:489:26)
at (../src/dag/lazy-store.ts:498:15)
at Array.forEach
at (../src/dag/lazy-store.ts:489:26)
at (../src/dag/lazy-store.ts:498:15)
at Array.forEach
at (../src/dag/lazy-store.ts:489:26)
at (../src/dag/lazy-store.ts:498:15)
at Array.forEach
at (../src/dag/lazy-store.ts:489:26)
at (../src/dag/lazy-store.ts:498:15)
at Array.forEach
at (../src/dag/lazy-store.ts:489:26)
at (../src/dag/lazy-store.ts:498:15)
at Array.forEach
at (../src/dag/lazy-store.ts:489:26)
at (../src/dag/lazy-store.ts:498:15)
at Array.forEach
at (../src/dag/lazy-store.ts:489:26)
at (../src/dag/lazy-store.ts:498:15)
at Array.forEach
at (../src/dag/lazy-store.ts:489:26)
at (../src/dag/lazy-store.ts:498:15)
at Array.forEach
at (../src/dag/lazy-store.ts:489:26)
at (../src/dag/lazy-store.ts:498:15)
at Array.forEach
at (../src/dag/lazy-store.ts:489:26)
at (../src/dag/lazy-store.ts:498:15)
at Array.forEach
at (../src/dag/lazy-store.ts:489:26)
at (../src/dag/lazy-store.ts:498:15)
at Array.forEach
at (../src/dag/lazy-store.ts:489:26)
at (../src/dag/lazy-store.ts:498:15)
at Array.forEach
at (../src/dag/lazy-store.ts:489:26)
at (../src/dag/lazy-store.ts:498:15)
at Array.forEach
at (../src/dag/lazy-store.ts:489:26)
at (../src/dag/lazy-store.ts:498:15)
at Array.forEach
The only way I think this can happen based on looking at the code is that a chunk is referencing itself. Something that should never happen.
@tmcw I'm going to add some asserts and attach a tarball here that you can try
Attached is a new build with asserts as well as the sourcemap for that build.
Fixed