Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled 'error' event #22

Closed
Karlheinzniebuhr opened this issue Jul 9, 2018 · 12 comments
Closed

Unhandled 'error' event #22

Karlheinzniebuhr opened this issue Jul 9, 2018 · 12 comments

Comments

@Karlheinzniebuhr
Copy link

Karlheinzniebuhr commented Jul 9, 2018

Got this error after downloading 155 from about a total of 3000 images

`[3088] Saved: 04007_autumnsunlightthroughthetrees_1280x1024.jpg
events.js:183
throw er; // Unhandled 'error' event
^

Error: read ECONNRESET
at _errnoException (util.js:992:11)
at TCP.onread (net.js:618:25)`

@p3x-robot
Copy link

you had an error in the connection internet. if you try it again it will work again. there is no need to change the code for this, this was a real error and not interfacelift downloader.

@p3x-robot
Copy link

I use it weekly, never an error, i download serial 1080p, 4k,5k all at once.

@Karlheinzniebuhr
Copy link
Author

it is pretty pointless to report bugs when getting this kind of attitude

@p3x-robot
Copy link

you just start the program again and if your internet is stable it will throw no error.

the bug was in the internet not in the program, although you could catch an error and handle it, but people try to work less then more when it still works with a stable internet ...

@p3x-robot
Copy link

p3x-robot commented Oct 13, 2018

ECONNRESET error is a very common known error in nodejs.

it means the internet connection was stopped while you were using any/all/this program.

@stevenbenner
Copy link
Owner

Sorry for the delayed response, somehow I missed this github issue.

I cannot reproduce this problem. Does this happen every time you run the script? If so, does it fail after the same number of files? If you wait a while does it start working again?

I'm thinking that it's either a connectivity issue or you're running into some kind of rate limiting from the web site.

@p3x-robot
Copy link

I think your rate limit is scraping slow enough, i never had an ECONNRESET error. Rate limit would give a HTTP 500 status bad gateway.

This was a connection issue.

@p3x-robot
Copy link

You can scrape it and during turn off the net. Then you will get this same error.

@p3x-robot
Copy link

You could provide a nice error like the internet broken etc.. Etc..

@stevenbenner
Copy link
Owner

Reopening as a possible improvement.

Yeah it would probably make sense to catch any errors thrown by http.get() and print out a more user friendly error.

I think some retry logic would be a good addition to handle a randomly dropped connection. If it fails with a connection error then wait a few seconds (probably implement exponential backoff) and retry, repeat up to some limit then fail. This would make it all around more resilient to random failures.

@p3x-robot
Copy link

Openwrt download logic is usually 5 retry, 5 sec, 10 sec, 15 sec, 20 sec, 30 sec, then it gives up.

stevenbenner added a commit that referenced this issue Feb 5, 2022
This patch adds retry behavior designed to handle intermittent
ECONNRESET and other connection errors during download operations.

The retry will be limited to 3 attempts, and each subsequent retry
will have an increasing delay to give time for the problem to
resolve itself. After the third failure it will give up on the URL
and move on to the next.

For issue: #22
@stevenbenner
Copy link
Owner

Fixed - or at least improved - in commit 0357eb2e3187525dd3b7e18273d3c7d173ba6131.

I have added error handling to download operations that will catch connection errors and retry the download after an increasing delay. The retry is limited to 3 attempts, after which it will move on to the next file in the download queue.

This fix is included in the latest 2.4.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants