SABnzbd / python exception on finishing manual download

Support for the Debian/Ubuntu package, created by JCFP.
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • 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.
Post Reply
krackt
Newbie
Newbie
Posts: 37
Joined: December 29th, 2010, 7:15 am

SABnzbd / python exception on finishing manual download

Post by krackt »

Not sure if this is the right forum so apologies if so.

SABnzbd crashes at the end of downloading if I manually start a download.
From sabnzbd.error.log:

Code: Select all

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.6/threading.py", line 532, in __bootstrap_inner
    self.run()
  File "/usr/share/sabnzbdplus/sabnzbd/postproc.py", line 183, in run
    if self.queue.empty(): HandleEmptyQueue()
  File "/usr/share/sabnzbdplus/sabnzbd/postproc.py", line 576, in HandleEmptyQueue
    sabnzbd.QUEUECOMPLETEACTION(sabnzbd.QUEUECOMPLETEARG)
  File "/usr/share/sabnzbdplus/sabnzbd/__init__.py", line 596, in run_script
    stup, need_shell, command, creationflags = sabnzbd.newsunpack.build_command(command)
  File "/usr/share/sabnzbdplus/sabnzbd/newsunpack.py", line 1040, in build_command
    command.insert(0, arg)
AttributeError: 'str' object has no attribute 'insert'
I have a script that shuts down my pc once scheduled downloads are finished, but for manual downloads the queue script is set to None.

Process list looks like this afterwards:
xbmc  1440  0.3  0.7 356608 24600 ?  Sl  16:13  0:07 /usr/bin/python /usr/bin/sabnzbdplus --daemon --autorestarted

TIA for input on resolving this.
SABnzbd 0.7.17 JCFP Ubuntu ppa
Precise 12.04.4 LTS x86_64
XBMC Gotham 14.0-alpha1 Git:577494a 20140406
ASRock ION 330-BD Intel Dual Core Atom 1.6GHz
4GB RAM | HDMI Display | Analogue Audio | Flirc IR
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: SABnzbd / python exception on finishing manual download

Post by shypike »

You have discovered a bug in SABnzbd.
It will only reveal itself when you set NICE or IONICE parameters in Config->Switches.
These parameters should not be used at all for an end-of-queue script
and in the current code they're used in the wrong way, causing the crash.

The only work-around now is to remove all NICE and IONICE parameters from Config->Switches.

The alternative is to patch the code in newsunpack.py.
Line 1034 is now:

Code: Select all

def build_command(command):
Insert this line after it:

Code: Select all

    if not isinstance(command, list): command = [command]
So the final code looks like this:

Code: Select all

def build_command(command):
    if not isinstance(command, list): command = [command]
    if not sabnzbd.WIN32:
Will be fixed in the next release.
krackt
Newbie
Newbie
Posts: 37
Joined: December 29th, 2010, 7:15 am

Re: SABnzbd / python exception on finishing manual download

Post by krackt »

Can confirm that inserting your code prevents the crash :) (...although the ionice command stll runs prior to the shutdown script)

I've removed the ionice parameters from my config for the time being. Thanks for your help and such great software.
SABnzbd 0.7.17 JCFP Ubuntu ppa
Precise 12.04.4 LTS x86_64
XBMC Gotham 14.0-alpha1 Git:577494a 20140406
ASRock ION 330-BD Intel Dual Core Atom 1.6GHz
4GB RAM | HDMI Display | Analogue Audio | Flirc IR
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: SABnzbd / python exception on finishing manual download

Post by shypike »

krackt wrote: (...although the ionice command stll runs prior to the shutdown script)
Yes, this just removed the error.
It's not clear cut whether or not nice and ionice should be used.
Opinions will differ.
I don't think it hurts much to run it with nice/ionice.
It certainly makes to code simpler to use them always.
I'll make up my mind for 0.6.0
Last edited by shypike on January 7th, 2011, 10:24 am, edited 1 time in total.
krackt
Newbie
Newbie
Posts: 37
Joined: December 29th, 2010, 7:15 am

Re: SABnzbd / python exception on finishing manual download

Post by krackt »

shypike wrote: It's not clear cut whether or not nice and ionice should be used.
Opinions will matter.
FWIW from my perspective SABnzbd is a perfect candidate for both "cpu" nice and ionice for managing cpu load generated by network and disk io from unrar.
SABnzbd 0.7.17 JCFP Ubuntu ppa
Precise 12.04.4 LTS x86_64
XBMC Gotham 14.0-alpha1 Git:577494a 20140406
ASRock ION 330-BD Intel Dual Core Atom 1.6GHz
4GB RAM | HDMI Display | Analogue Audio | Flirc IR
Post Reply