-
Notifications
You must be signed in to change notification settings - Fork 21
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
Exception handling for feed fetching #106
Comments
Thank you for our report. HTTPS feed fetching is a recent addition for me since I didn't have an updated Python version on the production machine. I managed to update Python to version 2.7.12 and now I have a couple of feed served via HTTPS with no issues. Back to your issue: fetcher code uses Requests library to handle connections which is very robust — it catches a lot of connection issues — and I wrap the fetch request around a RequestException and log it as network errors. You typically see these lines on the log:
Looking at your stack trace: the feed worker calls So the error originates from the SSL layer and should be wrapped by Requests. Of course googling for that exception gives us a myriad of bug reports, e.g.: DocNow/twarc#72 I'll go thru the linked discussion to figure out what's going on. The quick fix you could try is to catch everything on the https://github.com/passiomatic/coldsweat/blob/master/coldsweat/fetcher.py#L148 line. Doing this you should get an error log about the feed causing the connection error. When you have figured the offending feed please share it here, so I can do some testing it on my machine. |
Okay, I added the exception handling in the right place, but since then the error has not occurred anymore. I have a feeling the error may be caused by The feed entry is stuck in limbo now: it migrated, but has never worked since then. Now it doesn't show up in the feed overview, so I can't remove it. |
In fact osx.iusethis.com seems dead (timeout) and that could cause the connection error you have seen. In the meantime I've read the discussion previously linked to that OpenSSL exception and that boils down to the fact that Requests (or better urllib3) may use that - if installed - to handle SSL connections. Requests doesn't catch In Coldsweat makes little sense to catch that, because OpenSSL isn't even listed as project dependency.
This is weird because even if the feed is disabled or has zero entries it should be assigned to your user and hence be displayed in the feed list panel. If it has no users assigned it is effectively in limbo waiting to some user to add it to her feeds. This seemed a smart thing to down at the time but it turned out to be counterproductive. There a plan to fix this, see #63. |
I'm gonna close this since it was not reproducible by reporter anymore nor on my machine. |
The current feed fetching implementation does not catch exceptions. Over the past few days I've had a couple of
socket.timeout
andOpenSSL.SSL.SysCallError: (54, 'ECONNRESET')
exceptions happening. Crontab happily emails me about this fact, but there is absolutely no context other than a stack trace. This means that it is impossible to pin down which feed is causing this. It would be great if there were a way to add this.Looking at the code, the best place to catch the exception is probably in the
update_feed()
call at coldsweat/controllers.py:306. But that doesn't seem part of the stack trace. Line coldsweat/controllers.py:176 is an element, but at that point it is does not seem easy to track which feed was causing the exception.The text was updated successfully, but these errors were encountered: