5.1.3: jobs with missing articles sit at 99% and never fail (3 causes, reproduced, logs attached)

Report & discuss bugs found in 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.
Post Reply
therealncg
Newbie
Newbie
Posts: 11
Joined: August 2nd, 2023, 2:57 am

5.1.3: jobs with missing articles sit at 99% and never fail (3 causes, reproduced, logs attached)

Post by therealncg »

Hi all,

A follow-up of sorts to my 2023 thread Older jobs with missing parts will not fail, which 4.2.3 fixed. On 5.1.3 (Windows 11) I'm seeing the same symptom again: jobs on older, incomplete posts sit at 99% for hours and never fail. I've tracked it down to three things and reproduced each one by running 5.1.3, and again 5.2.0 Beta 2, from source against scripted NNTP servers. Full logs and the scripts are in the attached zip.

Test setup
  • SABnzbd 5.1.3 from git (tag 5.1.3, a647f73), Python 3.13, sabctools 9.6.3, Linux, debug logging with --log-all. The same scenarios on 5.2.0 Beta 2 (tag 5.2.0Beta2, 22537ef, sabctools 9.7.1) give the same results (for example segment 2 requested 123 times, the failed connects never benched, the Blocknews refusal never dropped), and the code involved is unchanged in develop (cd09879).
  • Settings: Maximum retries 2, Disable server penalties on, Only get articles for top of queue off, Abort jobs that cannot be completed on, server timeout 20.
  • Servers: p0 (priority 0) lacks segment 2, m1 (priority 1, 4 connections) misbehaves, b2 (priority 2) has segment 2. One file in 3 segments, each run 180 seconds.
  • Baseline, with m1 answering 430: the job completes in a few seconds with segment 2 from b2.
1. Maximum retries is never reached
m1 answers BODY for segment 2 with 503 (any code outside 220/222/223/411/423/430/451/500 behaves the same). m1 was asked for it 124 times in 180 seconds with Maximum retries at 2 (128 times with m1 Optional). b2 was never asked and the job stayed at 66%.

Code: Select all

2026-10-30 16:05:06,183::DEBUG::[newswrapper:435] Thread [email protected]: b'BODY <[email protected]>\r\n'
2026-10-30 16:05:06,185::DEBUG::[downloader:951] Thread [email protected]: Server error or unknown status code: 503
2026-10-30 16:05:06,710::DEBUG::[newswrapper:435] Thread [email protected]: b'BODY <[email protected]>\r\n'
2026-10-30 16:05:06,712::DEBUG::[downloader:951] Thread [email protected]: Server error or unknown status code: 503
[... 243 more lines like these ...]
2026-10-30 16:07:58,204::DEBUG::[downloader:951] Thread [email protected]: Server error or unknown status code: 503
As far as I can tell, NewsWrapper.discard() sends every retried article through Article.allow_new_fetcher(), which sets tries = 0. Article.get_article() and discard() each add 1, so "article.tries > max_art_tries()" can never be true (max_art_tries has minval 2). In 4.2.3, __reset_nw() put the article back on the same server's queue without resetting the count, so it moved on after the limit.

2. Optional servers are not benched for failed connects or "too many connections"
  • m1's TCP connects time out (like Windows error 10060): 19 "Failed to connect: timed out" in 180 seconds with m1 Optional, never benched, b2 never asked.
  • m1's TLS handshake never completes: 18 "Failed to connect: ... The handshake operation timed out", same result.
  • m1 refuses logins with "502 Too many connections: exceeded maximum number of connections per user": 26 refusals with m1 Optional, never benched.
  • For contrast, m1 accepts the connection but never answers: benched after 2 "Timed out", b2 supplies segment 2 and the job completes in 24 seconds.

Code: Select all

2026-10-30 16:12:34,462::WARNING::[newswrapper:705] Failed to connect: timed out [email protected]:12091 (m1.sabtest)
[... 17 more ...]
2026-10-30 16:15:14,747::WARNING::[newswrapper:705] Failed to connect: timed out [email protected]:12091 (m1.sabtest)
A failed connect goes through NNTP.error() and reset_nw() without touching server.bad_cons (only the busy-connection timeout check and the address lookup raise it), so maybe_block_server() never benches the server, and the articles already in its article_queue stay assigned to it until it recovers. In real life this is Giganews for me: my log for January to October 2026 has 2,711 connect timeouts (WinError 10060) and 179 "exceeded maximum number of connections per user" refusals from it.

3. A "quota exceeded" login refusal is treated as too many connections
My Blocknews block lapsed when I changed plans with my main provider, but I'd left the server enabled at priority 40. It answers AUTHINFO PASS with:

Code: Select all

502 news.blocknews.net: Access denied to your node or block quota exceeded (please check your user portal) - [email protected]
clues_too_many() matches "exceed", so finish_connect_nw() takes the too-many-connections branch (reset_nw plus plan_server) and never deactivates the server. The message also matches clues_login() ("access denied") and clues_pay() ("exceeded"), which would block it, but the too-many check runs first. To be fair to Blocknews, RFC 4643 says a rejected login MUST get 481, and a 502 there is the older RFC 2980 style; but NNTP has no code for "too many connections" at all (Giganews sends its limit as a 502 too), so SABnzbd has to go by the text anyway, and clues_login() and clues_pay() look like they were written for exactly this kind of message. Every minute the planned resume resets the server's queue and the segment goes straight back to it:

Code: Select all

2026-10-30 16:08:27,136::WARNING::[downloader:907] Server bn.sabtest reported: 502 news.blocknews.net: Access denied to your node or block quota exceeded (please check your user portal) - [email protected]
2026-10-30 16:09:27,195::DEBUG::[downloader:210] Resetting article queue for <Server: id=bn, host=bn.sabtest:12112> (deque([<Article: [email protected], bytes=67746, art_id=None>]))
2026-10-30 16:10:27,418::DEBUG::[downloader:210] Resetting article queue for <Server: id=bn, host=bn.sabtest:12112> (deque([<Article: [email protected], bytes=67746, art_id=None>]))
2026-10-30 16:11:26,286::DEBUG::[downloader:210] Resetting article queue for <Server: id=bn, host=bn.sabtest:12112> (deque([<Article: [email protected], bytes=67746, art_id=None>]))
With segment 2 missing on p0 and b2 and that server last in line, the job never finished. With "481 Authentication failed" instead, the server is dropped and the job finished in 32 seconds; with no priority 40 server, in 4 seconds; and disabling the refusing server through the API mid-run let the job finish 2 seconds later. So any segment that no server has waits on that server forever, and the job sits at 99% instead of failing.

Suggestions
  • Keep the per-server try count across retries, as 4.2.3 did.
  • Count failed connects (and repeated too-many refusals) towards bad_cons, or release a server's queued articles after repeated connect failures.
  • Check clues_login() and clues_pay() before clues_too_many(), or leave "quota" refusals out of the too-many branch.
The zip has the full debug logs for all 14 runs on 5.1.3 and the 9 key runs on 5.2.0 Beta 2, the fake servers' request logs, the configs, a results summary (RESULTS.txt), the key excerpts (EXCERPTS.txt) and the scripts to reproduce it. Happy to test a fix.
You can access the zip here: https://drive.google.com/file/d/11bLC_D ... sp=sharing

Note: Claude AI helped me diagnose and do some testing.

Thanks for all the work on SABnzbd.
Post Reply