Notice!
- If a Redis module was involved, please open an issue in the module's repo instead!
- I'm using ioredit on my node app but that is bootstrapped later
- If you're using docker on Apple M1, please make sure the image you're using was compiled for ARM!
- I'm using Docker image: redis:7.0.0-alpine (and it was working great)
Crash report
This is the log of my Docker container in which Redis bootstraps independently from other services (first, or second in parallel) and no shared volumes.
redis-service | 1:C 14 Ju l 2022 07:00:17.419 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo redis-service | 1:C 14 Jul 2022 07:00:17.419 # Redis version=7.0.0, bits=64, commit=00000000, modified=0, pid=1, just started redis-service | 1:C 14 Jul 2022 07:00:17.419 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf redis-service | 1:M 14 Jul 2022 07:00:17.419 * monotonic clock: POSIX clock_gettime redis-service | 1:M 14 Jul 2022 07:00:17.420 * Running mode=standalone, port=6379. redis-service | 1:M 14 Jul 2022 07:00:17.420 # Server initialized redis-service | 1:M 14 Jul 2022 07:00:17.420 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect. redis-service | 1:M 14 Jul 2022 07:00:17.421 * The AOF directory appendonlydir doesn't exist redis-service | 1:M 14 Jul 2022 07:00:17.421 # Wrong signature trying to load DB from file redis-service | 1:M 14 Jul 2022 07:00:17.421 # Fatal error loading the DB: Invalid argument. Exiting. redis-service exited with code 1
Additional information
- Ubuntu server 22
- Steps to reproduce: I can't figure out !
But prior to the crash, I suspect my node app maybe. My app logged:
READONLY You can't write against a read only replica." where stupidly I lost the whole log (thanks to my stupid deployment).
What I did
I deleted all db files of my Redis volume on Docker, but it didn't work (same error).
My app
In my app, all I do is basic operations that didn't cause any issues before but I suspect one loop though that I run on bootstrap:
function purgeKeys(redisDB) {
console.log('Redis purge is running')
var stream = redisDB.scanStream({ match: '*' })
stream.on('data', function (resultKeys) {
if (resultKeys.length) {
stream.pause()
redisDB.unlink(resultKeys).then(() => {
stream.resume()
})
}
})
stream.on('end', function () {
console.log('all keys have been visited')
})
}
So instead of doing this, I dropped removed persistence by Docker by removing volumes. But then I got the same error !!!
Comment From: ghost
What I did but I'm not sure, is to remove host files not only on host-db/data/* but host-db/* too.
The strange thing is that I believe host-db/ contained nothing ! or there were Redis files but in that case were hidden.
Comment From: oranagra
T looks like maybe the rdb file is corrupted ?
Comment From: ghost
I really don't know. But highly probably. I found that I was mixing volumes of Mongo and Redis so I separated those now it seems to work fine. Thanks !
Comment From: mirekphd
This error occurs for instance when you try to load a zipped archive of RESP files instead of a proper RDB file (not a tip:)
Comment From: ghost
@mirekphd thank you for the feedback. it's been a while I didn't test that again. but yes highly probably it's about the files. thanks