Skip to content

Commit

Permalink
Merge pull request #1651 from satherton/reduce-http-error-noise
Browse files Browse the repository at this point in the history
For HTTP requests, a missing request ID in the response is ignored if…
  • Loading branch information
etschannen committed Jun 4, 2019
2 parents 50f963d + 08e7f41 commit a6c0964
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions documentation/sphinx/source/release-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Fixes
-----

* Sometimes a minority of coordinators would not converge to the leader. `(PR #1649) <https://github.com/apple/foundationdb/pull/1649>`_
* HTTP responses indicating a server-side error are no longer expected to contain a ResponseID header. `(PR #1651) <https://github.com/apple/foundationdb/pull/1651>`_

6.1.8
=====
Expand Down
19 changes: 10 additions & 9 deletions fdbclient/HTTP.actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,17 +392,17 @@ namespace HTTP {
responseID = iid->second;
}
event.detail("RequestIDReceived", responseID);
if(requestID != responseID) {
err = http_bad_request_id();

// Log a non-debug a error
Severity sev = SevError;
// If the response code is 5xx (server error) and the responseID is empty then just warn
if(responseID.empty() && r->code >= 500 && r->code < 600) {
sev = SevWarnAlways;
}
// If the response code is 5xx (server error) then a response ID is not expected
// so a missing id will be ignored but a mismatching id will still be an error.
bool serverError = r->code >= 500 && r->code < 600;

// If request/response IDs do not match and either this is not a server error
// or it is but the response ID is not empty then log an error.
if(requestID != responseID && (!serverError || !responseID.empty()) ) {
err = http_bad_request_id();

TraceEvent(sev, "HTTPRequestFailedIDMismatch")
TraceEvent(SevError, "HTTPRequestFailedIDMismatch")
.detail("DebugID", conn->getDebugID())
.detail("RemoteAddress", conn->getPeerAddress())
.detail("Verb", verb)
Expand Down Expand Up @@ -433,6 +433,7 @@ namespace HTTP {
return r;
} catch(Error &e) {
double elapsed = timer() - send_start;
// A bad_request_id error would have already been logged in verbose mode before err is thrown above.
if(CLIENT_KNOBS->HTTP_VERBOSE_LEVEL > 0 && e.code() != error_code_http_bad_request_id) {
printf("[%s] HTTP *ERROR*=%s early=%d, time=%fs %s %s contentLen=%d [%d out]\n",
conn->getDebugID().toString().c_str(), e.name(), earlyResponse, elapsed, verb.c_str(), resource.c_str(), contentLen, total_sent);
Expand Down

0 comments on commit a6c0964

Please sign in to comment.