animetosho / Nyuu

Flexible usenet binary posting tool
221 stars 32 forks source link

Posting failed (Unexpected response to POST (code: 500): Max connect time exceeded) #40

Closed puziha closed 2 years ago

puziha commented 6 years ago

When I make larger uploads that take more than 24h nyuu crash with this error message

[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to POST (code: 500): Max connect time exceeded); article skipped
Posted: 91392+4/206649 (44.23%) @ 700 KiB/s (raw: 764.49 KiB/s) ETA 1d,13:28:53
/root/Nyuu/lib/nntp.js:699
                        throw new Error('Cannot make request whilst posting');
                        ^

Error: Cannot make request whilst posting
    at NNTP.__doRequest (/root/Nyuu/lib/nntp.js:699:10)
    at doPost (/root/Nyuu/lib/nntp.js:691:9)
    at NNTP.__post (/root/Nyuu/lib/nntp.js:692:5)
    at NNTP.post (/root/Nyuu/lib/nntp.js:632:8)
    at /root/Nyuu/lib/uploader.js:187:12
    at module.exports.take (/root/Nyuu/lib/queue.js:53:4)
    at doPost (/root/Nyuu/lib/uploader.js:173:30)
    at /root/Nyuu/lib/uploader.js:231:11
    at req.cbParent (/root/Nyuu/lib/nntp.js:645:20)
    at NNTP.<anonymous> (/root/Nyuu/lib/nntp.js:711:18)

--skip-error does not help because nyuu crash without handling the error 500 response. Can you add an option to friendly "reset" all connections (sessions?) to the news server after a specified period so nyuu does not run into this?

Would it also possible to have an option to append/extend a given NZB file? I sometimes have issues where the entire Internet connection drop and I need to restart my router while uploading which confuses nyuu and I have to abort the upload. This way could nyuu check what's been uploaded already and just continue where it was interrupted rather than re-upload everything so the indexes won't mix match.

animetosho commented 6 years ago

Thanks for reporting the issue, and sorry for the late reply.

I'll take a look into the issue so hopefully fix it so that it doesn't crash like that. I don't see the need for any option to 'reset' connections if the error can be handled transparently.

Nyuu should hopefully be able to survive a router restart (unless the timeouts don't allow for it - perhaps consider increasing them if that's the case). If it doesn't, are you able to post a log of what causes it to mess up?
If you need to take the connection down for extended periods of time, where you'll likely exceed retry timeouts, you could try suspending the process.

Some sort of resume/continue function would be nice. Not the easiest to code unfortunately, so will take time to do, but I do like the idea. For now, suspending the process might be a workable solution for pausing the process.

puziha commented 6 years ago

Many thanks. About the indexers, I have noticed they struggle to group files/posts when the file counter change, e.g. you have 10 files '[01/10] - blah01' ... '[10/10] - blah10', when the transfer is for whatever reason interrupted/aborted at 50%, you can start from scratch with all 10 files, or you just upload the files that are missed, but now since there are less files the counter is something like '[01/05] - blah06' ... '[05/05] - blah10' rather than '[06/10] - blah06' ... '[10/10] - blah10' which confuses indexers.

So some mechanism that help nyuu to keep track when (for whatever reason) an interruption happen would be really great.

animetosho commented 6 years ago

Committed changes should hopefully fix the unexpected crash. Been busy so sorry for the wait.

Nyuu isn't really built for resumptions at the moment, so file counters is an example of something that won't work right. If you're willing to do things a bit more manually, you could specifically change the subject lines so that the counters work (you'd still need to merge NZBs though).

puziha commented 6 years ago

Many thanks. I will try and keep you posted, but due to low upload bandwidth it may take few days.

RollingStar commented 2 years ago

I encountered this too. I will try the retryBadResp option and see if that fixes it. It happened on my two largest uploads.

[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[ERR ] Posting failed (Unexpected response to post (code: 500): Max connect time exceeded); article skipped
[WARN] NNTP connection unexpectedly lost, reconnecting and retrying post request... (attempt 1/5)
[INFO] All file(s) read...
[INFO] Finished uploading ... with 25 error(s) across 25 post(s).
animetosho commented 2 years ago

That error message is weird, but maybe try reducing the number of connections.

Retrying on an unknown response (Nyuu considers 500 to be unknown) may make it more resilient if you know you're getting these errors.