Page 1 of 1

Sql Vacuum error

Posted: June 8th, 2015, 4:40 am
by nass06
Hi,

I'om on readynas 6.2.3 and last sabnzbd for a year and know I have a problem when I'm downloading some stuff.
I have this error in my log :

Code: Select all

2015-06-08 10:47:31,387::DEBUG::[database:112] SQL: VACUUM
2015-06-08 10:47:31,388::INFO::[database:113] Traceback: 
Traceback (most recent call last):
  File "/apps/sabnzbd/sabnzbd/database.py", line 106, in execute
    self.c.execute(command)
OperationalError: database or disk is full
I removed history.db and still have the same error. I have about 200 GB free space, so I believe this is a sqlite error but I opened the db in my pc and everything seemes ok to me.

Thanks

Re: Sql Vacuum error

Posted: June 8th, 2015, 5:21 am
by sander
Which SABnzbd version?

Maybe your ReadyNAS has a temp partition that doesn't have enough free space (so: ful. No space at all)? If you can get a command prompt on the ReadyNAS, type "df -h" and post the output here.


FYI / FWIW:
http://stackoverflow.com/questions/2324 ... sk-is-full
http://sqlite.1065341.n5.nabble.com/quo ... 48238.html

FWIW2:

Code: Select all


sander@haring:~/.sabnzbd/admin$ sudo service sabnzbdplus stop
[sudo] password for sander:
 * Stopping SABnzbd+ binary newsgrabber     

sander@haring:~/.sabnzbd/admin$ ll history1.db
-rw-r--r-- 1 sander sander 25600 Jun  5 22:37 history1.db

sander@haring:~/.sabnzbd/admin$ sqlite3 history1.db "VACUUM;"

sander@haring:~/.sabnzbd/admin$ ll history1.db
-rw-r--r-- 1 sander sander 21504 Jun  8 12:30 history1.db
So, if your ReadyNAS has "sqlite3", what is the result of the above?

Re: Sql Vacuum error

Posted: June 8th, 2015, 7:16 am
by nass06
The last version 07.20.
I did a sqlite3 history1.db "VACUUM;" and no result. Maybe the download file was too big, I have sometimes an error when I try to download a file > 800Mo.

Thanks

Re: Sql Vacuum error

Posted: June 8th, 2015, 9:02 am
by sander
So ... problem solved/gone? If not ... post output of running "df -h" on your ReadyNAS ...

Re: Sql Vacuum error

Posted: June 8th, 2015, 9:15 am
by nass06
This is the output:

Code: Select all

Filesystem      Size  Used Avail Use% Mounted on
rootfs          4.0G  3.8G     0 100% /
tmpfs            10M  4.0K   10M   1% /dev
/dev/md0        4.0G  3.8G     0 100% /
tmpfs           248M  8.0K  248M   1% /dev/shm
tmpfs           248M  636K  248M   1% /run
tmpfs           248M     0  248M   0% /sys/fs/cgroup
tmpfs           248M     0  248M   0% /media
/dev/md126      1.4T  1.3T   84G  94% /data_1
/dev/md127      1.4T  1.2T  184G  87% /data
/dev/md127      1.4T  1.2T  184G  87% /home
/dev/md127      1.4T  1.2T  184G  87% /apps
Thank you

Re: Sql Vacuum error

Posted: June 8th, 2015, 4:46 pm
by sander
I only see too little space on your "/". So the question is where sqlite3 puts it's temp database. I don't know how to let sqlite3 print that. :(

Therefore, I had a look at the sqlite3 source code:

Code: Select all

/*
** Return the name of a directory in which to put temporary files.
** If no suitable temporary file directory can be found, return NULL.
*/
static const char *unixTempFileDir(void){
  static const char *azDirs[] = {
     0,
     0,
     0,
     "/var/tmp",
     "/usr/tmp",
     "/tmp",
     0        /* List terminator */
  };
  unsigned int i;
  struct stat buf;
  const char *zDir = 0;

  azDirs[0] = sqlite3_temp_directory;
  if( !azDirs[1] ) azDirs[1] = getenv("SQLITE_TMPDIR");
  if( !azDirs[2] ) azDirs[2] = getenv("TMPDIR");
  for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); zDir=azDirs[i++]){
    if( zDir==0 ) continue;
    if( osStat(zDir, &buf) ) continue;
    if( !S_ISDIR(buf.st_mode) ) continue;
    if( osAccess(zDir, 07) ) continue;
    break;
  }
  return zDir;
}
So the temp directory is (probably in order of priority):

Code: Select all

sqlite3_temp_directory
SQLITE_TMPDIR
SQLITE_TMPDIR
/var/tmp
/usr/tmp
/tmp
About sqlite3_temp_directory: "Applications are strongly discouraged from using this global variable". So let's focus on the other five directories, and the space they have:

Code: Select all

df -h `printenv SQLITE_TMPDIR`
df -h `printenv TMPDIR`
df -h /var/tmp
df -h /usr/tmp
df -h /tmp
Can you run that on your ReadyNAS?

For comparison, here is the output on my Linux system:

Code: Select all

sander@flappie:~$ df -h `printenv SQLITE_TMPDIR`
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        17G   14G  2,3G  86% /
none            4,0K     0  4,0K   0% /sys/fs/cgroup
udev            1,9G  4,0K  1,9G   1% /dev
tmpfs           376M  1,5M  374M   1% /run
none            5,0M     0  5,0M   0% /run/lock
none            1,9G   18M  1,9G   1% /run/shm
none            100M   68K  100M   1% /run/user
/dev/sda6        73G   66G  3,3G  96% /home

sander@flappie:~$ df -h `printenv TMPDIR`
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        17G   14G  2,3G  86% /
none            4,0K     0  4,0K   0% /sys/fs/cgroup
udev            1,9G  4,0K  1,9G   1% /dev
tmpfs           376M  1,5M  374M   1% /run
none            5,0M     0  5,0M   0% /run/lock
none            1,9G   18M  1,9G   1% /run/shm
none            100M   68K  100M   1% /run/user
/dev/sda6        73G   66G  3,3G  96% /home

sander@flappie:~$ df -h /var/tmp
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        17G   14G  2,3G  86% /

sander@flappie:~$ df -h /usr/tmp
df: ‘/usr/tmp’: No such file or directory

sander@flappie:~$ df -h /tmp
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        17G   14G  2,3G  86% /
sander@flappie:~$
Meaning the first ENV vars are not set, /var/tmp does exist (and has 2.3GB space available), /usr/tmp does not exist, and /tmp does exist (and has 2.3GB space available).

Re: Sql Vacuum error

Posted: June 9th, 2015, 4:16 am
by nass06
Hi,

This is the ouptput for df -h `printenv SQLITE_TMPDIR`

Code: Select all

Filesystem      Size  Used Avail Use% Mounted on
rootfs          4.0G  3.8G     0 100% /
tmpfs            10M  4.0K   10M   1% /dev
/dev/md0        4.0G  3.8G     0 100% /
tmpfs           248M  8.0K  248M   1% /dev/shm
tmpfs           248M  756K  247M   1% /run
tmpfs           248M     0  248M   0% /sys/fs/cgroup
tmpfs           248M     0  248M   0% /media
/dev/md126      1.4T  1.3T  145G  90% /data_1
/dev/md127      1.4T  1.3T  162G  89% /data
/dev/md127      1.4T  1.3T  162G  89% /home
/dev/md127      1.4T  1.3T  162G  89% /apps
For df -h `printenv TMPDIR`

Code: Select all

Filesystem      Size  Used Avail Use% Mounted on
rootfs          4.0G  3.8G     0 100% /
tmpfs            10M  4.0K   10M   1% /dev
/dev/md0        4.0G  3.8G     0 100% /
tmpfs           248M  8.0K  248M   1% /dev/shm
tmpfs           248M  756K  247M   1% /run
tmpfs           248M     0  248M   0% /sys/fs/cgroup
tmpfs           248M     0  248M   0% /media
/dev/md126      1.4T  1.3T  145G  90% /data_1
/dev/md127      1.4T  1.3T  162G  89% /data
/dev/md127      1.4T  1.3T  162G  89% /home
/dev/md127      1.4T  1.3T  162G  89% /apps
df -h /var/tmp

Code: Select all

Filesystem      Size  Used Avail Use% Mounted on
/dev/md0        4.0G  3.8G     0 100% /
df -h /usr/tmp

Code: Select all

df: `/usr/tmp': No such file or directory
df: no file systems processed
And last one df -h /tmp

Code: Select all

Filesystem      Size  Used Avail Use% Mounted on
/dev/md0        4.0G  3.8G     0 100% /
Thank you very much for your effort.

Re: Sql Vacuum error

Posted: June 9th, 2015, 4:28 am
by sander
OK! Interpretation:

The ENV vars SQLITE_TMPDIR en TMPDIR do not exist, so sqlite3 cannot and will not not use that. Clear.

Your /var/tmp is full: "Avail: 0". So I would clean up there (in that directory, or on the same partition), and check again.

Re: Sql Vacuum error

Posted: June 9th, 2015, 2:01 pm
by nass06
I managed to free only 158M, I don't know how I can free more, I'm a newbie in linux world but I'm a windows developer so I have a good background.
I did a simlik for plex cache because is used a lot of space.

So what is the rootfs partition? it's the /root directory? Or something else? And how can I free more space

Thnak you

Re: Sql Vacuum error

Posted: June 10th, 2015, 12:29 am
by sander
I expect your ReadyNAS GUI has better tools to clean up your / partition, but here are some tips for the CLI:

To find files bigger than 100MB:

Code: Select all

find / -type f -size +100M
You should ignore anything starting with:

Code: Select all

/data_1
/data
/home
/apps
as that is on a separate parition or disk