mercurius-js / cache

Adds an in-process caching layer to Mercurius. Federation is fully supported.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid string length at StorageRedis.clearReferences

11laflame opened this issue · comments

[11:22:07.302] ERROR (28): acd/storage/redis.clearReferences error
err: {
"type": "RangeError",
"message": "Invalid string length",
"stack":
RangeError: Invalid string length
at Object.write (/usr/app/node_modules/ioredis/built/Pipeline.js:310:29)
at EventEmitter.sendCommand (/usr/app/node_modules/ioredis/built/Redis.js:387:28)
at execPipeline (/usr/app/node_modules/ioredis/built/Pipeline.js:330:25)
at Pipeline.exec (/usr/app/node_modules/ioredis/built/Pipeline.js:282:5)
at StorageRedis.clearReferences (/usr/app/node_modules/async-cache-dedupe/src/storage/redis.js:323:56)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async StorageRedis._invalidateReferences (/usr/app/node_modules/async-cache-dedupe/src/storage/redis.js:227:5)
at async StorageRedis.invalidate (/usr/app/node_modules/async-cache-dedupe/src/storage/redis.js:193:16)
at async Cache.invalidateAll (/usr/app/node_modules/async-cache-dedupe/src/cache.js:185:5)
at async Promise.all (index 0)
}

When I try to invalidate array of references, catching this error
Using chunks, maximum array of 10, if we had a lot, but it's even crushes with 4

https://github.com/11laflame/cache-bug-setup

check please, follow readme steps

It's imitating reference functionality in mercurius-cache

policy: {
test: { references: generateReferences, key: generateCacheKey },
}

generateReferences returning array ["model:sdj3-3dsd3-sddsd", "model:2dkd3-33dsdd2-2d2"]

This is what async-cache-dedupe creators answered:

The problem in your example is that you are setting the model directly in https://github.com/11laflame/cache-bug-setup/blob/e630b47da14594664ad7de4ea1b88da097cbfe51/src/services/fill.js#L11, without using the methods from async-cache-dedupe to set the cache. This creates a bad data structure in redis, making the server crash happen.

Looks like it's not a mercurius-cache issue, am I missing something @11laflame?

see mcollina/async-cache-dedupe#89

It's my issue there, he is saying it's not async-cache-dedupe problem, you say it's not mercurius-cache problem

We still can't tell where the issue is, we're investigating to figure out, we are not able to detect the issue with the current information we have, so we're asking you for more information.

Can we keep the conversation in a single place? I'm closing this one.

Thank you for collaboration

Yes, we can continue in a single place