Skip to content

Instantly share code, notes, and snippets.

@xxswingxx
Forked from hivokas/fix-of-redis-error.md
Created April 28, 2019 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xxswingxx/4f3dcf09550ffa0c82de37559e85093a to your computer and use it in GitHub Desktop.
Save xxswingxx/4f3dcf09550ffa0c82de37559e85093a to your computer and use it in GitHub Desktop.
Fix of Redis error (Can't save in background: fork: Cannot allocate memory)

Errors from Laravel logs:

MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.

ERR Error running script (call to f_1af8e79ebe56ad4d7910f2e116e2555983099baf): @user_script:8: @user_script: 8: -MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.

Errors from Redis logs (/var/log/redis/redis-server.log):

* 1 changes in 900 seconds. Saving...
# Can't save in background: fork: Cannot allocate memory

Fix:

sudo sysctl vm.overcommit_memory=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment