Page 1 of 2

Sab keeps crashing: AttributeError: 'NoneType' object has no attribute 'bytes'

Posted: June 13th, 2022, 12:13 pm
by KageKeeper
I am running Sab in Docker using linuxserver[dot]io image version 3.6.0-ls66. Docker is hosted on Ubuntu 20.04.

Sab has been working as expected. However, within the last couple of days Sab has been very unstable, and keeps crashing, restarting, and crashing again.

I would post the logs or a pastebin, but I am not allowed to post links. Even though I have replaced any 'links' I am unable to post it. How would you like me to show the logs?

I appreciate any assistance.

Re: Sab keeps crashing...

Posted: June 13th, 2022, 12:58 pm
by sander
post on pastebin, and post the link here like pastebin . com / akdsjflkjalsdjlf

Re: Sab keeps crashing...

Posted: June 13th, 2022, 1:02 pm
by KageKeeper
Gotcha. Thank you.

pastebin . com / 93yyfiGw

Re: Sab keeps crashing...

Posted: June 13th, 2022, 1:10 pm
by sander
OK, so https://pastebin.com/93yyfiGw

Code: Select all

/usr/lib/python3.9/site-packages/cherrypy/process/servers.py:416: UserWarning: Unable to verify that the server is bound on 8080
  warnings.warn(msg)
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 973, in _bootstrap_inner
    self.run()
  File "/app/sabnzbd/sabnzbd/downloader.py", line 935, in run
    self.decode(article, nw.data)
  File "/app/sabnzbd/sabnzbd/downloader.py", line 523, in decode
    sabnzbd.NzbQueue.register_article(article, success=False)
  File "/app/sabnzbd/sabnzbd/nzbqueue.py", line 754, in register_article
    and not sabnzbd.Assembler.partial_nzf_in_queue(nzf)
  File "/app/sabnzbd/sabnzbd/assembler.py", line 63, in partial_nzf_in_queue
    return (nzf.nzo, nzf, False) in self.queue.queue
  File "/app/sabnzbd/sabnzbd/nzbstuff.py", line 502, in __eq__
    if self.bytes == other.bytes or len(self.decodetable) == len(other.decodetable):
AttributeError: 'NoneType' object has no attribute 'bytes'
2022-06-13 09:41:18,181::WARNING::[__init__:503] Restarting because of crashed downloader

Re: Sab keeps crashing...

Posted: June 13th, 2022, 1:11 pm
by KageKeeper
That is indeed the logs I see repeated over and over. :)

Re: Sab keeps crashing...

Posted: June 13th, 2022, 1:27 pm
by safihre
You should clear your queue and restart, something got corrupted.

Re: Sab keeps crashing: AttributeError: 'NoneType' object has no attribute 'bytes'

Posted: June 13th, 2022, 1:30 pm
by sander
The essential part is

Code: Select all

  File "/app/sabnzbd/sabnzbd/nzbstuff.py", line 502, in __eq__
    if self.bytes == other.bytes or len(self.decodetable) == len(other.decodetable):
AttributeError: 'NoneType' object has no attribute 'bytes'
That it happens, is a bug.

That line of code was introduced/altered on 04-04-2021, so more than a year ago, so nothing recent.

I'm sure how to workaround this, other than trying with brute-force deleting your queue, or going back to an old version of SAB.

Maybe Safihre has a better idea.

Re: Sab keeps crashing: AttributeError: 'NoneType' object has no attribute 'bytes'

Posted: June 13th, 2022, 2:10 pm
by sander
@KageKeeper

Before removing the queue, can I do an experiment with you? I made a script that checks the files:

Code: Select all

sander@brixit:~/.sabnzbd/admin$ for i in *.sab; do ./pickle_pretty_print.py $i; done
postproc2.sab: Yes, correct pickle file. Size:  2
queue10.sab: Yes, correct pickle file. Size:  3
Rating.sab: something else
rss_data.sab: Yes, correct pickle file. Size:  4
totals10.sab: Yes, correct pickle file. Size:  14
watched_data2.sab: Yes, correct pickle file. Size:  3
So I would like you to run that script ... to see if it detects your queue is corrupt.

Re: Sab keeps crashing: AttributeError: 'NoneType' object has no attribute 'bytes'

Posted: June 13th, 2022, 2:23 pm
by KageKeeper
sander wrote: June 13th, 2022, 2:10 pm @KageKeeper

Before removing the queue, can I do an experiment with you? I made a script that checks the files:

Code: Select all

sander@brixit:~/.sabnzbd/admin$ for i in *.sab; do ./pickle_pretty_print.py $i; done
postproc2.sab: Yes, correct pickle file. Size:  2
queue10.sab: Yes, correct pickle file. Size:  3
Rating.sab: something else
rss_data.sab: Yes, correct pickle file. Size:  4
totals10.sab: Yes, correct pickle file. Size:  14
watched_data2.sab: Yes, correct pickle file. Size:  3
So I would like you to run that script ... to see if it detects your queue is corrupt.
Aww. I already wiped the queue and restarted everything. Sorry! If this happens again I will definitely look at your script.

Re: Sab keeps crashing: AttributeError: 'NoneType' object has no attribute 'bytes'

Posted: June 13th, 2022, 3:24 pm
by KageKeeper
So I removed the Docker container and emptied the queues. About an hour later I am getting the exact same errors again.

@sander If you want to try that script now, I am game.

Re: Sab keeps crashing: AttributeError: 'NoneType' object has no attribute 'bytes'

Posted: June 13th, 2022, 3:33 pm
by KageKeeper
There are some new errors now as well.

pastebin. com / XwnvpAps

Re: Sab keeps crashing: AttributeError: 'NoneType' object has no attribute 'bytes'

Posted: June 14th, 2022, 1:51 am
by safihre
Interesting. Maybe this is is a bug.
Do you have a very active queue with lots of URLs being fetched and/or downloads active? Did you manually Retry a job maybe?

Re: Sab keeps crashing: AttributeError: 'NoneType' object has no attribute 'bytes'

Posted: June 14th, 2022, 3:15 am
by sander
So https://pastebin.com/XwnvpAps

Code: Select all

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/cherrypy/_cprequest.py", line 638, in respond
    self._do_respond(path_info)
  File "/usr/lib/python3.9/site-packages/cherrypy/_cprequest.py", line 697, in _do_respond
    response.body = self.handler()
  File "/usr/lib/python3.9/site-packages/cherrypy/lib/encoding.py", line 223, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/lib/python3.9/site-packages/cherrypy/_cpdispatch.py", line 54, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/app/sabnzbd/sabnzbd/interface.py", line 180, in internal_wrap
    return wrap_func(*args, **kwargs)
  File "/app/sabnzbd/sabnzbd/interface.py", line 472, in api
    return api_handler(kwargs)
  File "/app/sabnzbd/sabnzbd/api.py", line 104, in api_handler
    response = _api_table.get(mode, (_api_undefined, 2))[0](name, kwargs)
  File "/app/sabnzbd/sabnzbd/api.py", line 414, in _api_status
    return _api_status_table.get(name, (_api_fullstatus, 2))[0](value, kwargs)
  File "/app/sabnzbd/sabnzbd/api.py", line 405, in _api_fullstatus
    status = build_status(
  File "/app/sabnzbd/sabnzbd/api.py", line 1256, in build_status
    info["publicipv4"] = publicipv4()
  File "/app/sabnzbd/sabnzbd/getipaddress.py", line 114, in publicipv4
    result = addresslookup4(sabnzbd.cfg.selftest_host())
  File "/app/sabnzbd/sabnzbd/getipaddress.py", line 48, in func_wrapper
    return sabnzbd.THREAD_POOL.submit(item, *args, **kwargs).result(max_timeout)
  File "/usr/lib/python3.9/concurrent/futures/thread.py", line 161, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
Quite a different error IMHO, so a separate thread (split it)?
@safihre the workaround in https://github.com/sabnzbd/sabnzbd/comm ... ff=unified avoids this, right?
Interesting this too happens in a LSIO docker image

@KageKeeper what is your DNS setup? Something with pihole / adguard maybe?

Re: Sab keeps crashing: AttributeError: 'NoneType' object has no attribute 'bytes'

Posted: June 14th, 2022, 4:31 am
by safihre
@sander: the second error can be ignored, it's because SABnzbd already detected a crash and it is in the process of shutting down. If a Status-window is opened then, it will throw this crash. Will fix this in next release. But for now, no need to investigate DNS etc :)
We can stick to finding out why KageKeeper has invalid NZO's in his queue.

Re: Sab keeps crashing: AttributeError: 'NoneType' object has no attribute 'bytes'

Posted: June 14th, 2022, 11:10 am
by KageKeeper
safihre wrote: June 14th, 2022, 1:51 am Interesting. Maybe this is is a bug.
Do you have a very active queue with lots of URLs being fetched and/or downloads active? Did you manually Retry a job maybe?
Yes to both questions. :)