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: 11
Joined: August 8th, 2019, 6:08 pm

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

Post by ash7777 »

Thanks! It's working much better now.

I'm mystified by something. If I understand correctly, these lines:

Code: Select all

        try:
            self.servercount[serverid] += bytes
        except KeyError:
            # Not yet known, so initialize:
            self.servercount[serverid] = bytes
are functionally equivalent to these lines (which are the original code):

Code: Select all

        if serverid in self.servercount:
            self.servercount[serverid] += bytes
        else:
            self.servercount[serverid] = bytes
and these lines work around the problem I was having:

Code: Select all

        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
which implies I should be seeing log entries that say "Non-int value in ..." and I'm not seeing any such lines. Does that surprise you?

User avatar
sander
Release Testers
Release Testers
Posts: 7176
Joined: January 22nd, 2008, 2:22 pm

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

Post by sander »

"much better"? Not 100% good?

"I'm not seeing any such lines. Does that surprise you?" Yes, that does surprise me: I would expect it once.

ash7777
Newbie
Newbie
Posts: 11
Joined: August 8th, 2019, 6:08 pm

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

Post by ash7777 »

Sorry, I tend to understate. It's been running for about an hour and everything seems completely normal.

It is possible the message was logged once. I cleaned the log files at shortly after applying the fix.

User avatar
sander
Release Testers
Release Testers
Posts: 7176
Joined: January 22nd, 2008, 2:22 pm

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

Post by sander »

Good that it works.

Pity you cleaned the log files: I was very curious what Warning print would say.

User avatar
sander
Release Testers
Release Testers
Posts: 7176
Joined: January 22nd, 2008, 2:22 pm

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

Post by sander »

ash7777

safihre has changed the code in a much better way (https://github.com/sabnzbd/sabnzbd/comm ... 27c7c36a27 specifcally https://github.com/sabnzbd/sabnzbd/comm ... cL775-R777 ), hopefully removing the root cause of your problem.
That means that with the next release, which you will receive via the Ubuntu jcfp PPA (so beta3, or anything higher than beta2), the problem should not occur anymore (and my workaround is not necesary anymore).

ash7777
Newbie
Newbie
Posts: 11
Joined: August 8th, 2019, 6:08 pm

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

Post by ash7777 »

I haven't upgraded since this happened, and it occurred again yesterday.

The log message was:

Code: Select all

 Non-int value in self.servercount[serverid]: b'220'

User avatar
sander
Release Testers
Release Testers
Posts: 7176
Joined: January 22nd, 2008, 2:22 pm

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

Post by sander »

ash7777 wrote:
October 13th, 2020, 9:01 am
I haven't upgraded since this happened
Upgrade! There were a lot of improvements and releases since June 2020.

Post Reply