preprocessing stuck at 99% if incomplete on smb3

Get help with all aspects of SABnzbd
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.
User avatar
sander
Release Testers
Release Testers
Posts: 9062
Joined: January 22nd, 2008, 2:22 pm

Re: preprocessing stuck at 99% if incomplete on smb3

Post by sander »

Let 's wait for @safihre (or maybe @shypike) what they say about the code, and why it is done like this. And after that consider solutions / workarounds.

BTW: What does Microsoft says about the exit code / resultcode of rmdir on directories. Nothing on https://technet.microsoft.com/en-us/lib ... 90990.aspx :-(
defkev
Newbie
Newbie
Posts: 13
Joined: May 19th, 2015, 7:17 pm

Re: preprocessing stuck at 99% if incomplete on smb3

Post by defkev »

I suppose the errorcode 9009 for rmdir on windows just means what rmdir reported, aka. "The directory is not empty."

The only rule of thumb which applies on all platforms dating back like forever is that your program should return 0 on a clean exit.
Only if something went fu it should return a non-zero code. What that is and how it translates into something "human readable" is pretty much up to whoever wrote the code.

Unfortunately Google doesn't give much of a explanation either, the topic is probably to generic.

But interessting how rmdir on two different platforms is acting in the exact same strange way and one of these platforms is from the same guys who are mainly responsible for the SMB protocol ;D
User avatar
sander
Release Testers
Release Testers
Posts: 9062
Joined: January 22nd, 2008, 2:22 pm

Re: preprocessing stuck at 99% if incomplete on smb3

Post by sander »

FWIW: I found this text on https://ss64.com/nt/rd.html ... so a difference between ERRORLEVEL (not set) and Exit Code.
Exit code / Errorlevel
In normal use RD will fail to return an ERRORLEVEL to the shell, irrespective if the command succeeds or fails the ERRORLEVEL will be left unchanged.

It will however set an Exit Code

Directory deleted successfully = 0
Invalid option = 1
Directory not found = 2
Access denied = 5
Directory in use = 32
Directory not empty = 145

A workaround to detect a non zero Exit Code from RD is to use conditional execution to run a command if the RD fails, the second command can be anything, an Echo, Goto or CALL statement:

RD NonExistentFolder || Echo This failed!
If you delete folders using PowerShell then a True/False return code ($?) will be set correctly.
EDIT

FWIW #2:

Python-on-Windows talking to the Windows-share seems to work correctly:

Code: Select all

Z:\>c:\python27\python -c "import os ; os.rmdir('Z:\\Downloads') "
Traceback (most recent call last):
  File "<string>", line 1, in <module>
WindowsError: [Error 145] The directory is not empty: 'Z:\\Downloads'
... so it's a problem when Samba and/or Linux is involved?
User avatar
safihre
Administrator
Administrator
Posts: 5521
Joined: April 30th, 2015, 7:35 am
Contact:

Re: preprocessing stuck at 99% if incomplete on smb3

Post by safihre »

Back from holidays :)
So the reuse is triggered when a job is added again from history (if it failed, using Retry button) or when using the precheck.
Basically sabnzbd will treat it as a whole new job, if the pre check was successful.
So it seems to me that we can easily set keep_dir=True, since we want to keep that directory anyway.
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
User avatar
safihre
Administrator
Administrator
Posts: 5521
Joined: April 30th, 2015, 7:35 am
Contact:

Re: preprocessing stuck at 99% if incomplete on smb3

Post by safihre »

Patched it.
Will be in 2.0.1.
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
Post Reply