Sabnzbd keeps crashing TypeError: can't concat int to bytes

Questions and bug reports for Beta releases should be posted here.
Forum rules
Help us help you:
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
ash7777
Newbie
Newbie
Posts: 12
Joined: August 8th, 2019, 6:08 pm

Sabnzbd keeps crashing TypeError: can't concat int to bytes

Post by ash7777 »

Sabnzbd is crashing continually with the error "TypeError: can't concat int to bytes", but I can't post logs because filesystem paths apparently look like links (post keeps failing with the message "New users are not allowed to post links").

I might be able to send them to someone by PM.
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Sabnzbd keeps crashing

Post by sander »

which version of SAB exactly? 3.0.0 beta2 is out.

You can anything on Pastebin, en then post the URL (with spaces) here.
ash7777
Newbie
Newbie
Posts: 12
Joined: August 8th, 2019, 6:08 pm

Re: Sabnzbd keeps crashing

Post by ash7777 »

That's a good suggestion!

Info is here: pastebin dot com slash Z8aV9yK2
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Sabnzbd keeps crashing

Post by sander »

Based on your log on https://pastebin.com/Z8aV9yK2 this line is relevant:

Code: Select all

[happyeyeballs:146] Quickest IP address for blah.com (port 563, ssl 1, preferipv6 True) is None
I think you're running an older version of SABnzbd 3.0.0; the "None" was fixed one month ago, before Beta1 and Beta2

So ... update your SABnzbd 3.0.0 to Beta2 or the current git version.

EDIT: this was the commit I was referring to https://github.com/sabnzbd/sabnzbd/comm ... e4341e9584 ... 19 April, so you're running a very old version of SABnzbd 3.0.0: > 1.5 month old. Please update

EDIT 2: if you're on Ubuntu, make sure you're using the PPA ppa:jcfp/ppa (and not the temp for Ubuntu 18.04 that has not been updated after alpha1)
ash7777
Newbie
Newbie
Posts: 12
Joined: August 8th, 2019, 6:08 pm

Re: Sabnzbd keeps crashing

Post by ash7777 »

I think I'm using PPA ppa:jcfp/ppa - I followed the instructions at https://sabnzbd.org/wiki/installation/i ... buntu-repo for the install.

I just did
sudo apt-get update
sudo apt-get install sabnzbdplus
in the shell and got
sabnzbdplus is already the newest version (3.0.0~0git20200408+dfsg-1).
0 upgraded, 0 newly installed, 0 to remove and 27 not upgraded.
in response.

Are those the correct commands?

Something I'm confused about. I used the nobeta repository and when I did the sudo apt-get update, the first two lines were:
but I seem to have a beta version (3.0.0-develop) installed.
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Sabnzbd keeps crashing [version 3.0.0~0git20200408+dfsg-1]

Post by sander »

Code: Select all

sabnzbdplus is already the newest version (3.0.0~0git20200408+dfsg-1).
Old! 20200408 = 2020-04-08, so almost two months old

This is what my Ubuntu has:

Code: Select all

sabnzbdplus is already the newest version (3.0.0~beta2-0ubuntu1~jcfp1~18.04).
How to solve? If you commands do not work, I would remove sabnzbdplus, and reinstall. And check your PPA settings again in /etc/apt/
ash7777
Newbie
Newbie
Posts: 12
Joined: August 8th, 2019, 6:08 pm

Re: Sabnzbd keeps crashing

Post by ash7777 »

I uninstalled and installed 3.0.0~beta2-0ubuntu1~jcfp1~20.04 and it still crashes the same way.

It did change the log line as you mentioned:
[happyeyeballs:146] Quickest IP address for blah.com (port 563, ssl 1, preferipv6 True) is 67.67.67.67
The line numbers in the crash changed:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/share/sabnzbdplus/sabnzbd/downloader.py", line 594, in run
nzo.update_download_stats(BPSMeter.do.bps, server.id, bytes_received)
File "/usr/share/sabnzbdplus/sabnzbd/nzbstuff.py", line 775, in update_download_stats
self.servercount[serverid] += bytes
TypeError: can't concat int to bytes
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Sabnzbd keeps crashing

Post by sander »

On http://127.0.0.1:8080/config/ what do you see at "Version:"?
ash7777
Newbie
Newbie
Posts: 12
Joined: August 8th, 2019, 6:08 pm

Re: Sabnzbd keeps crashing

Post by ash7777 »

On http://127.0.0.1:8080/config/ what do you see at "Version:"?
It says:
3.0.0Beta2 [faedd22]
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Sabnzbd keeps crashing: TypeError: can't concat int to bytes

Post by sander »

OK, so SAB version is now OK & uptodate.

Back to your error:

Code: Select all

self.servercount[serverid] += bytes
TypeError: can't concat int to bytes
Let's see with simple Python code:

Code: Select all

>>> b"dddd" + 3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can't concat int to bytes
and

Code: Select all

>>> b"123" + 3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can't concat int to bytes
and

Code: Select all

>>> a = b"123"
>>> a += 3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can't concat int to bytes
So self.servercount[serverid] must be a byte value.

You're hiding the server you're using. Why is that?


Code: Select all

To be complete: The other way around, you get a different error, so that is not the case
>>> a = 123
>>> a += b"456"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +=: 'int' and 'bytes'
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Sabnzbd keeps crashing

Post by sander »

The problem might be in ~/.sabnzbd/admin/totals10.sab

So, can you do this:

Stop sabnzbd
mv ~/.sabnzbd/admin/totals10.sab ~/.sabnzbd/admin/totals10.sab.OLD
Start sabnzbd, and do a few downloads
ash7777
Newbie
Newbie
Posts: 12
Joined: August 8th, 2019, 6:08 pm

Re: Sabnzbd keeps crashing TypeError: can't concat int to bytes

Post by ash7777 »

You're hiding the server you're using. Why is that?
I'm not really, I just wasn't sure what I'm allowed to post here. There are two servers: news.newshosting.com and news.eweka.nl

I tried your suggestion of deleting totals10.sab and it did not fix the problem, although it seemed like it survived a little longer than usual before dying. That could be my imagination though.

If it helps, I'm only interested in preserving my queue and configuration if possible. I'm game to try deleting anything else.
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Sabnzbd keeps crashing TypeError: can't concat int to bytes

Post by sander »

OK, so no weird newsserver. Good

I have a detection & workaround & solution, which involves a few different lines in nzbstuff.py replacing https://github.com/sabnzbd/sabnzbd/blob ... #L774-L777

What do you want?
I can provide the new lines, which you have to put into that file. You must be aware of python formatting (correct spacing etc)
or
I can provide a complete nzbstuff.py which you then have to put in place of that whole file.

In both cases you must know how to become root.

PS: can you use basic git commands? So: "git clone" and "git checkout"?
ash7777
Newbie
Newbie
Posts: 12
Joined: August 8th, 2019, 6:08 pm

Re: Sabnzbd keeps crashing TypeError: can't concat int to bytes

Post by ash7777 »

I can handle editing the installed source. I also know how to use git, although I think I prefer just editing the installed source if the changes don't depend on other changes I don't have.
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: Sabnzbd keeps crashing TypeError: can't concat int to bytes

Post by sander »

OK, here we go:

in sabnzbd/nzbstuff.py
replace the https://github.com/sabnzbd/sabnzbd/blob ... #L774-L777

Code: Select all

        if serverid in self.servercount:
            self.servercount[serverid] += bytes
        else:
            self.servercount[serverid] = bytes
with

Code: Select all

 
        try:
            self.servercount[serverid] += bytes
        except KeyError:
            # Not yet known, so initialize:
            self.servercount[serverid] = bytes
        except Exception as e:
            # could not add int, so reset
            logging.warning("Non-int value in self.servercount[serverid]: %s", self.servercount[serverid])
            self.servercount[serverid] = bytes
Make sure the spacing on the left is in line with other spacing.
Post Reply