Skip to content

Handling for internal server errors#246

Merged
dcrankshaw merged 4 commits intoucbrise:developfrom
Corey-Zumar:error_handling
Jul 6, 2017
Merged

Handling for internal server errors#246
dcrankshaw merged 4 commits intoucbrise:developfrom
Corey-Zumar:error_handling

Conversation

@Corey-Zumar
Copy link
Contributor

If the thread of execution responsible for delivering an HTTP prediction response encounters an unexpected error, this PR ensures that we respond with error code 500 instead of timing out.

@AmplabJenkins
Copy link

Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/511/
Test FAILed.

Copy link
Contributor

@dcrankshaw dcrankshaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you rethrowing the exceptions inside a try block?

prediction.then([response, app_metrics](boost::future<Response> f) {
if (f.has_exception()) {
try {
boost::rethrow_exception(f.get_exception_ptr());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we re-throwing the exception here? This will immediately be caught by the catch statement right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. If the boost future encounters a fatal exception, it will store it in an exception pointer tied to the future. rethrow_exception allows us to obtain the original exception that was thrown and log / handle it appropriately. This flow is a documented way of performing exception propagation when using boost futures / threads.

@dcrankshaw
Copy link
Contributor

Does this fix #245?

@Corey-Zumar
Copy link
Contributor Author

@dcrankshaw This fixes the Connection Aborted behavior cited in #245. Instead, fatal errors will return HTTP code 500. However, I doubt this fixes the underlying cause of the exception being thrown in #245.

@dcrankshaw
Copy link
Contributor

Sounds good. I figured you got that from somewhere, just wanted to double check. I'll merge once the tests pass.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Clipper-PRB/515/
Test PASSed.

@dcrankshaw dcrankshaw merged commit dd81781 into ucbrise:develop Jul 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants