Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sabnzbd truncates its own config file #186

Closed
sym3tri opened this issue Nov 2, 2014 · 6 comments
Closed

sabnzbd truncates its own config file #186

sym3tri opened this issue Nov 2, 2014 · 6 comments
Assignees
Milestone

Comments

@sym3tri
Copy link

sym3tri commented Nov 2, 2014

This happened when I ran out of disk space. Noticed the config file was on disk, but empty. No backup file around. Found this in the logs:

2014-11-01 11:48:40,801::INFO::[SABnzbd:335] Web dir is /usr/share/SABnzbd/interfaces/Plush
2014-11-01 11:48:40,802::INFO::[SABnzbd:335] Web dir is /usr/share/SABnzbd/interfaces/Config
2014-11-01 11:48:40,807::WARNING::[config:782] Cannot create backup file for /etc/sabnzbd.ini.bak
2014-11-01 11:48:40,807::INFO::[config:783] Traceback:
Traceback (most recent call last):
  File "/usr/share/SABnzbd/sabnzbd/config.py", line 779, in save_config
    shutil.copyfile(filename, bakname)
  File "/usr/lib64/python2.7/shutil.py", line 83, in copyfile
    with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/etc/sabnzbd.ini.bak'
2014-11-01 11:48:40,814::ERROR::[config:791] Cannot write to INI file /etc/sabnzbd.ini
2014-11-01 11:48:40,815::INFO::[config:792] Traceback:
Traceback (most recent call last):
  File "/usr/share/SABnzbd/sabnzbd/config.py", line 787, in save_config
    CFG.write()
  File "/usr/share/SABnzbd/sabnzbd/utils/configobj.py", line 2113, in write
    h.close()
IOError: [Errno 28] No space left on device
@thezoggy
Copy link
Contributor

thezoggy commented Nov 3, 2014

sab stores config in memory and writes on exit. so yes you prob shouldnt run out of hd space on the drive you run sab. nothing we can do about user error

@sym3tri
Copy link
Author

sym3tri commented Nov 3, 2014

how about not attempting to write the config file if the backup operation fails? seems like a reasonable check to make the software more resilient to failures.

@shypike
Copy link
Member

shypike commented Nov 3, 2014

Could be a bug.
If the write action fails, the backup should be renamed back.
Although when disk-full also blocks rename actions, that could fail.
I'll have a closer look at this.
Which OS are you using?

@thezoggy
Copy link
Contributor

thezoggy commented Nov 3, 2014

when does sab backup the config (in sb we do it on every upgrade, thus the previous back could be months old)?

@sym3tri
Copy link
Author

sym3tri commented Nov 3, 2014

@shypike Fedora 19

@shypike shypike self-assigned this Mar 27, 2015
@shypike shypike added this to the 0.9.0 milestone Jan 19, 2016
@shypike shypike modified the milestones: 1.1.1, 1.1.0 Sep 9, 2016
@shypike shypike removed the Backlog label Sep 9, 2016
@shypike shypike modified the milestones: 1.2.0, 1.1.1 Oct 3, 2016
@Safihre
Copy link
Member

Safihre commented Oct 14, 2016

I tried to reproduce, but SAB already first tries to make the backup and only if that succeeds it will save a new config. Don't think we can make it safer than that..
This is a very exotic problem since it was not reported again in 2 years.
Closing for now, nothing we can really do more.

@Safihre Safihre closed this as completed Oct 14, 2016
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants