-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Catch client exception and rethrow to avoid loader failure to crash otp #6921
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
Catch client exception and rethrow to avoid loader failure to crash otp #6921
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #6921 +/- ##
==========================================
Coverage 72.10% 72.10%
+ Complexity 19660 19659 -1
==========================================
Files 2124 2124
Lines 79507 79510 +3
Branches 8050 8050
==========================================
+ Hits 57326 57329 +3
+ Misses 19344 19343 -1
- Partials 2837 2838 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, the fix seems to work. We just need to think a bit about how we want to test this (if we want to test it).
| } | ||
|
|
||
| @Test | ||
| void testClientExceptionRethrowsAsUpdaterConstructionException() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the correct place for this? There is also GbfsFeedLoaderTest which seems to have more tests similar to this. It has some real integration tests which are disabled (because we try to avoid those), but we usually avoid mocking things as well. I'm not sure what would be the best approach here. @leonardehrenfried has created a submodule for real integration tests which are run in CI if the pr has certain label. I wonder if that could be expanded with realtime updater related tests. Although, in this case a real integration test might not make any sense. I can bring this up in the dev meeting tomorrow.
There are still the tests from #4826, I'm not sure what we should do about those and if they really test anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put the test there just to avoid wasting any time figuring out a better place for it - knowing that we might not even want the test in the first place. Personally, I don't think it's needed, but at least it proved that my change did what I expected it to do.
|
We have quite a bit of exception handling logic in the updaters: Lines 45 to 47 in e54d80b
I think what is different now is that we used to not make HTTP calls during setup but now we do, because we must detect the version. That is also the reason why the test didn't do anything - it predates the I think we ought to spend a little bit of time thinking about how we want to do the error handling and testing. |
Summary
This fixes a bug likely introduced by #6735 , that causes OTP to crash if the gbfs loader fails to load a feed, e.g. due to dns failure or similar. The problem was the the http client exception was not caught anywhere. This PR catches it and rethrows it as a UpdaterConstructionException, which in turn ends up just logging a warning and skipping that updater.
Issue
Fixes #6912
Unit tests
Added a unit test which covers this fix in GbfsFeedMapperTest which seems to be a bit of a bucket test class for testing gbfs updater classes. We may want to clean that up a bit?
Documentation
No documentation as this is considered a bug fix.
Changelog
Skipping
Bumping the serialization version id
Not needed.