liangdabiao / redis

Automatically exported from code.google.com/p/redis
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

No graceful recovery of db write errors #524

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What version of Redis you are using, in what kind of Operating System?
2.2.4 on Debian 64 bit
What is the problem you are experiencing?
If redis is started where it has no write access to the disk DB, it repeatedly 
tries to open the file and writes an error into the DB

What steps will reproduce the problem?
chmod 444 dump.db
restart redis

Do you have an INFO output? Please past it here.
The error in the log is 
Apr 16 05:58:00 home-host redis[2479]: Background saving error
Apr 16 05:58:00 home-host redis[2479]: 1 changes in 900 seconds. Saving...
Apr 16 05:58:00 home-host redis[2479]: Background saving started by pid 20105
Apr 16 05:58:00 home-host redis[20105]: Failed saving the DB: Permission denied
Apr 16 05:58:00 home-host redis[2479]: Background saving error
Apr 16 05:58:00 home-host redis[2479]: 1 changes in 900 seconds. Saving...
Apr 16 05:58:00 home-host redis[2479]: Background saving started by pid 20106
Apr 16 05:58:00 home-host redis[20106]: Failed saving the DB: Permission denied
Apr 16 05:58:00 home-host redis[2479]: Background saving error
Apr 16 05:58:00 home-host redis[2479]: 1 changes in 900 seconds. Saving...
Apr 16 05:58:00 home-host redis[2479]: Background saving started by pid 20107
Apr 16 05:58:00 home-host redis[20107]: Failed saving the DB: Permission denied
Apr 16 05:58:00 home-host redis[2479]: Background saving error

-----------------------

The bigger issue is when I try to shutdown redis through a SHUTDOWN, it fails 

Apr 16 06:01:30 home-host redis[2479]: 1 changes in 900 seconds. Saving...
Apr 16 06:01:30 home-host redis[2479]: Background saving started by pid 21193
Apr 16 06:01:30 home-host redis[21193]: Failed saving the DB: Permission denied
Apr 16 06:01:30 home-host redis[2479]: User requested shutdown, saving DB...
Apr 16 06:01:30 home-host redis[2479]: There is a live saving child. Killing it!
Apr 16 06:01:30 home-host redis[2479]: Failed saving the DB: Permission denied
Apr 16 06:01:30 home-host redis[2479]: Error trying to save the DB, can't exit
Apr 16 06:01:30 home-host redis[2479]: SIGTERM received but errors trying to 
shut down the server, check the logs for more information

If it is a crash, can you please paste the stack trace that you can find in
the log file or on standard output? This is really useful for us!

Please provide any additional information below.

I would imagine that write error to DB would return errors during BGSAVE etc.,  
which does not happen instead the logs get filled up with these messages.  Also 
the shutdown should still be handled well.

Original issue reported on code.google.com by venugopa...@gmail.com on 16 Apr 2011 at 12:37