Databases

Redis reports MISCONF 'stop writes on BGSAVE error' after BGSAVE failure — how to debug and recover safely?

Environment

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

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

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

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

Diagnostic steps

  1. 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.
  1. 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.
  1. 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.
  1. 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.
  1. 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

Confirmed fixes

No fix has been independently verified for this scenario. Treat the causes below as diagnostic hypotheses.

Question

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?

COMMUNITY RESPONSES

Verified community troubleshooting

0 replies

No answers yet..

Showing 0 of 0 community responses
AI DIAGNOSTICS

Incident analysis

Updated 3w ago• Trouble ID

Most likely causes

Filesystem full or insufficient space in same filesystem for RDB temporary file (hypothesis). 9%
Configuration stop-writes-on-bgsave-error is enabled and Redis correctly entered MISCONF after repeated BGSAVE errors (observed behavior). 8%
Fork failed because of memory pressure/overcommit settings or ulimits preventing child process creation (hypothesis). 7%

Summary

Hypotheses: (1) BGSAVE failed due to disk full or IO error so Redis set stop-writes-on-bgsave-error to protect dataset; (2) Fork failed due to insufficient memory/overcommit or ulimit for fork, causing BGSAVE error; (3) Permission or SELinux prevented writing RDB file; (4) RDB file corruption detected on loading so server avoids writes.

Suggested Fixes

Diagnostic step 1
Check redis-server logs (journalctl -u redis or /var/log/redis/redis-server.log) for the exact BGSAVE error messages and timestamps. Result meaning: Log entries indicating 'fork: Cannot allocate memory', 'No space left on device', or permission errors point to memory/disk/permission causes respectively.
Diagnostic step 2
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). Result meaning: 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.
Diagnostic step 3
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). Result meaning: If enabled, Redis will enter MISCONF on BGSAVE failures. Knowing this confirms behavior and influences whether to clear flag after addressing root cause.

Continue troubleshooting

Matched from the title, description and tags