Page 1 of 1

Python crash on centos server?

Posted: December 30th, 2014, 4:59 pm
by nzbtuxnews
Hello,

Upon restarting a centos 7 VM because of virtio problems, I decided to confirm that the services were properly running (SAB, SB, HP, etc) and accessing SAB's interface (to confirm its running) I discovered that the queue was gone. I went to status and restarted SAB, the queue reappeared but looking in the logs I noticed three occurences of what seems to be a crash trace of some sort:

Code: Select all

2014-12-30 16:49:25,689::INFO::[_cplogging:55] [30/Dec/2014:16:49:25] HTTP 
Request Headers:
  AUTHORIZATION: Basic XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX==
  REFERER: https://centos:9090/sabnzbd/
  Content-Length: 97
  CONNECTION: keep-alive
  COOKIE: plushContainerWidth=100%25; plushMultiOps=1; plushNoTopMenu=0; plushQueuePerPage=40; user="2|1:0|10:1419948087|4:user|44:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=|XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; snatched_view2=list; soon_view2=thumbs; suggestions_charts_menu_selected=suggestions; wanted_view2=details; advanced_toggle_checked=1; late_view2=list; PHPSESSID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; SpryMedia_DataTables_log_table_logs=%7B%22iCreate%22%3A1419976164255%2C%22iStart%22%3A0%2C%22iEnd%22%3A0%2C%22iLength%22%3A25%2C%22aaSorting%22%3A%5B%5B0%2C%22desc%22%2C1%5D%5D%2C%22oSearch%22%3A%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%22aoSearchCols%22%3A%5B%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%5D%2C%22abVisCols%22%3A%5Btrue%2Ctrue%2Ctrue%5D%7D; SpryMedia_DataTables_album_table_artistpage=%7B%22iCreate%22%3A1419975114771%2C%22iStart%22%3A0%2C%22iEnd%22%3A13%2C%22iLength%22%3A10%2C%22aaSorting%22%3A%5B%5B4%2C%22asc%22%2C0%5D%2C%5B3%2C%22desc%22%2C1%5D%5D%2C%22oSearch%22%3A%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%22aoSearchCols%22%3A%5B%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%2C%7B%22bCaseInsensitive%22%3Atrue%2C%22sSearch%22%3A%22%22%2C%22bRegex%22%3Afalse%2C%22bSmart%22%3Atrue%7D%5D%2C%22abVisCols%22%3A%5Btrue%2Ctrue%2Ctrue%2Ctrue%2Ctrue%2Ctrue%2Ctrue%2Ctrue%2Ctrue%5D%7D
  Remote-Addr: XXX.XXX.XXX.XXX
  PRAGMA: no-cache
  X-REQUESTED-WITH: XMLHttpRequest
  USER-AGENT: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0
  HOST: centos:9090
  CACHE-CONTROL: no-cache
  ACCEPT: */*
  ACCEPT-LANGUAGE: en-US,en;q=0.5
  ACCEPT-ENCODING: gzip, deflate
  Content-Type: application/x-www-form-urlencoded; charset=UTF-8
2014-12-30 16:49:25,741::DEBUG::[_cplogging:55] [30/Dec/2014:16:49:25] HTTP Traceback (most recent call last):
  File "/var/www/html/SABnzbd/cherrypy/_cprequest.py", line 618, in respond
    cherrypy.response.body = self.handler()
  File "/var/www/html/SABnzbd/cherrypy/_cpdispatch.py", line 25, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/var/www/html/SABnzbd/sabnzbd/interface.py", line 413, in tapi
    return api_handler(kwargs)
  File "/var/www/html/SABnzbd/sabnzbd/api.py", line 101, in api_handler
    response = _api_table.get(mode, _api_undefined)(name, output, kwargs)
  File "/var/www/html/SABnzbd/sabnzbd/api.py", line 460, in _api_history
    del_job_files(history_db.get_failed_paths(search))
  File "/var/www/html/SABnzbd/sabnzbd/api.py", line 1541, in del_job_files
    remove_all(path, recursive=True)
  File "/var/www/html/SABnzbd/sabnzbd/misc.py", line 1313, in remove_all
    files = globber(path, pattern)
  File "/var/www/html/SABnzbd/sabnzbd/misc.py", line 78, in globber
    return glob.glob(os.path.join(path, pattern).replace('[', '[[]'))
  File "/usr/lib64/python2.7/glob.py", line 27, in glob
    return list(iglob(pathname))
  File "/usr/lib64/python2.7/glob.py", line 60, in iglob
    yield os.path.join(dirname, name)
  File "/usr/lib64/python2.7/posixpath.py", line 80, in join
    path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0x96 in position 28: ordinal not in range(128)
Anything to worry about? What can cause this?
Thanks

Re: Python crash on centos server?

Posted: December 30th, 2014, 5:58 pm
by sander
I can't answer your question, but just some remarks:

Code: Select all

UnicodeDecodeError: 'ascii' codec can't decode byte 0x96 in position 28: ordinal not in range(128)
0x96 = 150 in decimal, so indeed not in the official ASCII range up to 128, so the error is logically correct
0x96 = '–', which looks like a normal dash or minus '-' (ASCII 45), but is different: "The en dash (–) is slightly wider than the hyphen (-) but narrower than the em dash (—). "

Easy way to reproduce:

Code: Select all

>>> "–".encode('utf-8')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)
and

Code: Select all

>>> chr(0x96).encode('utf-8')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0x96 in position 0: ordinal not in range(128)
Your error message is from:

Code: Select all

path += '/' + b
... so one of those variables (probably b) has that non-ASCII code

Re: Python crash on centos server?

Posted: December 30th, 2014, 6:41 pm
by nzbtuxnews
Hey Sanders,

First could you move this thread to the beta forums? I am using SAB 0.7.x

Code: Select all

Version: 	0.7.x
Uptime: 	1h
Config File: 	/var/www/html/.sabnzbd/sabnzbd.ini
Used cache: 	Cached 0 articles (0 B)
Parameters: 	/var/www/html/SABnzbd/SABnzbd.py --daemon --pid /var/run --config-file /var/www/html/.sabnzbd/sabnzbd.ini -p
Python Version: 	2.7.5 (default, Jun 17 2014, 18:11:42) [GCC 4.8.2 20140120 (Red Hat 4.8.2-16)]
Secondly, good programming logic analysis on your part! I have discovered that this happens when I press the "Purge Failed NZBs and delete files" button in the history queue... Nothing happens. This started lately as if I recall, last week or so this button was working just fine. Like I said when I press the button nothing happens (the queue should empty) and the log entry is created with the output I already provided in my previous post. Maybe these two are totally unrelated so Ill do more testing to confirm the relation..

Can I assume a problem in SAB or at the OS level?

Re: Python crash on centos server?

Posted: December 30th, 2014, 6:48 pm
by sander
So ... maybe there is something in your History that's causing this?

If your queue is emtpy, you could consider doing this:
Stop SABnzbd
Then go to ~/.sabnzbd and in there rename directory "admin" to "admin2"
Then start SABnzbd

... what does that give?

Re: Python crash on centos server?

Posted: December 30th, 2014, 9:45 pm
by nzbtuxnews
Before I try what you suggested, let me ask: Right now the history queue is empty but there are dozens of jobs waiting to be started in the job queue... Will I lose all my jobs if I mv admin to admin2???

Re: Python crash on centos server?

Posted: December 31st, 2014, 2:41 am
by sander
nzbtuxnews wrote:Before I try what you suggested, let me ask: Right now the history queue is empty but there are dozens of jobs waiting to be started in the job queue... Will I lose all my jobs if I mv admin to admin2???
Yes, you will loose them. So ... don't do it if you have stuff there.

I don't know if removing history1.db helps ... I tried here, and that does NOT remove history ... ???

Re: Python crash on centos server?

Posted: January 2nd, 2015, 9:24 am
by nzbtuxnews
I don't know if removing history1.db helps ... I tried here, and that does NOT remove history ... ???
Definitely weird if that db file is supposed to contain the history queue....

I did what you suggested (mv admin admin2 and restart SAB).

So far so good. Nothing in the logs showing that bug yet but everything is empty in SAB so I wouldnt expect much at this time,.. Let me push a few jobs in SAB and make them fail and see if that happens again.