Repository: trafficserver Updated Branches: refs/heads/master 86a3d404a -> 940ff5c56
TS-4267: HTTP/2 Updates to debugging This closes #522 Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/940ff5c5 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/940ff5c5 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/940ff5c5 Branch: refs/heads/master Commit: 940ff5c56bebabb96130a55c2a17212c5c518138 Parents: 86a3d40 Author: Bryan Call <[email protected]> Authored: Thu Mar 10 09:12:32 2016 -0800 Committer: Bryan Call <[email protected]> Committed: Thu Mar 10 09:12:32 2016 -0800 ---------------------------------------------------------------------- proxy/http2/Http2ConnectionState.cc | 13 ++++++++++--- proxy/http2/Http2DebugNames.cc | 23 +++++++++++++++++++++++ proxy/http2/Http2DebugNames.h | 1 + proxy/http2/Http2Stream.h | 2 ++ 4 files changed, 36 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/940ff5c5/proxy/http2/Http2ConnectionState.cc ---------------------------------------------------------------------- diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc index 4d33830..077f8ea 100644 --- a/proxy/http2/Http2ConnectionState.cc +++ b/proxy/http2/Http2ConnectionState.cc @@ -533,11 +533,10 @@ rcv_window_update_frame(Http2ConnectionState &cstate, const Http2Frame &frame) uint32_t size; const Http2StreamId sid = frame.header().streamid; - DebugHttp2Stream(cstate.ua_session, sid, "Received WINDOW_UPDATE frame"); - // A WINDOW_UPDATE frame with a length other than 4 octets MUST be // treated as a connection error of type FRAME_SIZE_ERROR. if (frame.header().length != HTTP2_WINDOW_UPDATE_LEN) { + DebugHttp2Stream(cstate.ua_session, sid, "Received WINDOW_UPDATE frame - length incorrect"); return Http2Error(HTTP2_ERROR_CLASS_CONNECTION, HTTP2_ERROR_FRAME_SIZE_ERROR); } @@ -546,6 +545,9 @@ rcv_window_update_frame(Http2ConnectionState &cstate, const Http2Frame &frame) frame.reader()->memcpy(buf, sizeof(buf), 0); http2_parse_window_update(make_iovec(buf, sizeof(buf)), size); + DebugHttp2Stream(cstate.ua_session, sid, "Received WINDOW_UPDATE frame - updated to: %zd delta: %u", + (cstate.client_rwnd + size), size); + // A receiver MUST treat the receipt of a WINDOW_UPDATE frame with a // connection // flow control window increment of 0 as a connection error of type @@ -582,6 +584,9 @@ rcv_window_update_frame(Http2ConnectionState &cstate, const Http2Frame &frame) frame.reader()->memcpy(buf, sizeof(buf), 0); http2_parse_window_update(make_iovec(buf, sizeof(buf)), size); + DebugHttp2Stream(cstate.ua_session, sid, "Received WINDOW_UPDATE frame - updated to: %zd delta: %u", + (stream->client_rwnd + size), size); + // A receiver MUST treat the receipt of a WINDOW_UPDATE frame with an // flow control window increment of 0 as a stream error of type // PROTOCOL_ERROR; @@ -919,7 +924,6 @@ Http2ConnectionState::send_data_frame(FetchSM *fetch_sm) uint8_t payload_buffer[buf_len]; Http2Stream *stream = static_cast<Http2Stream *>(fetch_sm->ext_get_user_data()); - DebugHttp2Stream(ua_session, stream->get_id(), "Send DATA frame"); if (stream->get_state() == HTTP2_STREAM_STATE_CLOSED) { return; @@ -952,6 +956,8 @@ Http2ConnectionState::send_data_frame(FetchSM *fetch_sm) } // Create frame + DebugHttp2Stream(ua_session, stream->get_id(), "Send DATA frame - client window con: %zd stream: %zd payload: %zd", client_rwnd, + stream->client_rwnd, payload_length); Http2Frame data(HTTP2_FRAME_TYPE_DATA, stream->get_id(), flags); data.alloc(buffer_size_index[HTTP2_FRAME_TYPE_DATA]); http2_write_data(payload_buffer, payload_length, data.write()); @@ -959,6 +965,7 @@ Http2ConnectionState::send_data_frame(FetchSM *fetch_sm) // Change state to 'closed' if its end of DATAs. if (flags & HTTP2_FLAGS_DATA_END_STREAM) { + DebugHttp2Stream(ua_session, stream->get_id(), "End of DATA frame"); if (!stream->change_state(data.header().type, data.header().flags)) { this->send_goaway_frame(stream->get_id(), HTTP2_ERROR_PROTOCOL_ERROR); } http://git-wip-us.apache.org/repos/asf/trafficserver/blob/940ff5c5/proxy/http2/Http2DebugNames.cc ---------------------------------------------------------------------- diff --git a/proxy/http2/Http2DebugNames.cc b/proxy/http2/Http2DebugNames.cc index 1a4f967..8009cfd 100644 --- a/proxy/http2/Http2DebugNames.cc +++ b/proxy/http2/Http2DebugNames.cc @@ -45,3 +45,26 @@ Http2DebugNames::get_settings_param_name(uint16_t id) return "UNKNOWN"; } + +const char * +Http2DebugNames::get_state_name(uint16_t id) +{ + switch (id) { + case HTTP2_STREAM_STATE_IDLE: + return "HTTP2_STREAM_STATE_IDLE"; + case HTTP2_STREAM_STATE_RESERVED_LOCAL: + return "HTTP2_STREAM_STATE_RESERVED_LOCAL"; + case HTTP2_STREAM_STATE_RESERVED_REMOTE: + return "HTTP2_STREAM_STATE_RESERVED_REMOTE"; + case HTTP2_STREAM_STATE_OPEN: + return "HTTP2_STREAM_STATE_OPEN"; + case HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL: + return "HTTP2_STREAM_STATE_HALF_CLOSED_LOCAL"; + case HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE: + return "HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE"; + case HTTP2_STREAM_STATE_CLOSED: + return "HTTP2_STREAM_STATE_CLOSED"; + } + + return "UNKNOWN"; +} http://git-wip-us.apache.org/repos/asf/trafficserver/blob/940ff5c5/proxy/http2/Http2DebugNames.h ---------------------------------------------------------------------- diff --git a/proxy/http2/Http2DebugNames.h b/proxy/http2/Http2DebugNames.h index cf6d077..b836477 100644 --- a/proxy/http2/Http2DebugNames.h +++ b/proxy/http2/Http2DebugNames.h @@ -30,6 +30,7 @@ class Http2DebugNames { public: static const char *get_settings_param_name(uint16_t id); + static const char *get_state_name(uint16_t id); }; #endif // __HTTP2_DEBUG_NAMES_H__ http://git-wip-us.apache.org/repos/asf/trafficserver/blob/940ff5c5/proxy/http2/Http2Stream.h ---------------------------------------------------------------------- diff --git a/proxy/http2/Http2Stream.h b/proxy/http2/Http2Stream.h index 4bc196d..b89fb02 100644 --- a/proxy/http2/Http2Stream.h +++ b/proxy/http2/Http2Stream.h @@ -26,6 +26,7 @@ #include "HTTP2.h" #include "FetchSM.h" +#include "Http2DebugNames.h" class Http2ConnectionState; @@ -46,6 +47,7 @@ public: ~Http2Stream() { + Debug("http2_stream", "[%d] state: %s", _id, Http2DebugNames::get_state_name(_state)); HTTP2_DECREMENT_THREAD_DYN_STAT(HTTP2_STAT_CURRENT_CLIENT_STREAM_COUNT, _thread); ink_hrtime end_time = Thread::get_hrtime(); HTTP2_SUM_THREAD_DYN_STAT(HTTP2_STAT_TOTAL_TRANSACTIONS_TIME, _thread, end_time - _start_time);
