Redis reports MISCONF 'stop writes on BGSAVE error' after BGSAVE failure — how to debug and recover safely?
Environment
Redis 6.2 on Linux (systemd unit). Persistence configured with RDB (save) enabled, appendonly disabled. Redis runs as redis:redis and writes RDB files to /var/lib/redis. Recent disk maintenance and backups occurred before issue.
Symptoms
Writes (SET, INCR, etc.) return error 'MISCONF Redis is configured to stop accepting writes'. Redis logs show BGSAVE: fork failed or BGSAVE error with 'permission denied' or 'no space left on device' in some cases.
Observations
Disk df -h reports low free space on partition containing /var/lib/redis or dmesg shows I/O errors. RDB file ownership or permissions look correct, but the last successful save timestamp is old. Restarting Redis did not clear MISCONF; logs still indicate inability to create snapshot or fork fails.
Already attempted
Restarted Redis process, freed some disk space, checked file permissions, attempted BGREWRITEAOF (if enabled) but same MISCONF. No explicit manual RDB deletion attempted. No AOF present to fallback to.
Diagnostic steps
- Check redis-server logs (journalctl -u redis or /var/log/redis/redis-server.log) for the exact BGSAVE error messages and timestamps.
- What the result means: Log entries indicating 'fork: Cannot allocate memory', 'No space left on device', or permission errors point to memory/disk/permission causes respectively.
- Run df -h and df -i on all filesystems used by Redis (dir and tmpdir). Also inspect dmesg for I/O errors and check available memory and swap (free -m).
- What the result means: If disk is full or inodes exhausted on Redis dir/tmp, BGSAVE cannot write temp file; if memory low or OOM messages present, fork likely failed due to insufficient RAM.
- Query CONFIG GET stop-writes-on-bgsave-error and inspect if it's set to yes (redis-cli CONFIG GET stop-writes-on-bgsave-error).
- What the result means: If enabled, Redis will enter MISCONF on BGSAVE failures. Knowing this confirms behavior and influences whether to clear flag after addressing root cause.
- Attempt a manual SAVE (blocking) or BGSAVE after freeing disk or adjusting ulimits; observe return and logs.
- What the result means: If SAVE succeeds, the dataset persisted and MISCONF should clear. If SAVE/BGSAVE still fails with same error, further investigation (permissions, SELinux, memory) required.
- Inspect ownership/permissions of Redis dir and tmpdir, and check SELinux/AppArmor denials in audit logs.
- What the result means: If permission or SELinux denials present, fix those and retry BGSAVE; fixes that allow snapshot write will clear MISCONF.
Confirmed fixes
No fix has been independently verified for this scenario. Treat the causes below as diagnostic hypotheses.
Question
What diagnostic steps confirm whether disk, permissions, fork failure or config stop-writes setting is causing MISCONF, and what safe recovery steps restore write capability with minimal data loss?
Verified community troubleshooting
No answers yet..
Incident analysis
Most likely causes
Summary
Suggested Fixes
Continue troubleshooting
Related troubles
Matched from the title, description and tags
- Databases43% match
Redis returns MISCONF and stops accepting writes after BGSAVE failure
Open1 answer - Databases30% match
Redis replica stops applying updates after RDB mismatch during background save (BGSAVE)
Open0 answers - Databases28% match
Redis replica stops applying updates after RDB mismatch during BGSAVE causing replication gap and growing replication backlog
Open1 answer