This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/7.1.x by this push:
new c330f26 Separate mutex of Http2ClientSession and Http2Stream
c330f26 is described below
commit c330f26efa4f49853cf7358109977a6fc2dc3c2c
Author: Masaori Koshiba <[email protected]>
AuthorDate: Wed Feb 21 16:00:14 2018 +0900
Separate mutex of Http2ClientSession and Http2Stream
When parent selection feature is enabled, TS starts dns reverse lookup on
every transaction.
With HTTP/2, HostDBProcessor::getby() is called simultaneously and lock
contention starts.
This serialize the transactions of HTTP/2.
(cherry picked from commit f35bc7902438abc9a69515cb9f616193aa1cf6b2)
Conflicts:
proxy/http2/Http2Stream.cc
---
proxy/http2/Http2ConnectionState.cc | 6 +++++-
proxy/http2/Http2Stream.cc | 10 ++++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/proxy/http2/Http2ConnectionState.cc
b/proxy/http2/Http2ConnectionState.cc
index 24ed35f..a83914d 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -716,6 +716,7 @@ rcv_window_update_frame(Http2ConnectionState &cstate, const
Http2Frame &frame)
ssize_t wnd = std::min(cstate.client_rwnd, stream->client_rwnd);
if (!stream->is_closed() && stream->get_state() ==
Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE && wnd > 0) {
+ SCOPED_MUTEX_LOCK(lock, stream->mutex, this_ethread());
stream->restart_sending();
}
}
@@ -1028,7 +1029,7 @@ Http2ConnectionState::create_stream(Http2StreamId new_id,
Http2Error &error)
++total_client_streams_count;
new_stream->set_parent(ua_session);
- new_stream->mutex = ua_session->mutex;
+ new_stream->mutex = new_ProxyMutex();
new_stream->is_first_transaction_flag = get_stream_requests() == 0;
increment_stream_requests();
ua_session->get_netvc()->add_to_active_queue();
@@ -1072,6 +1073,7 @@ Http2ConnectionState::restart_streams()
Http2Stream *next = static_cast<Http2Stream *>(s->link.next ?
s->link.next : stream_list.head);
if (!s->is_closed() && s->get_state() ==
Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE &&
std::min(this->client_rwnd, s->client_rwnd) > 0) {
+ SCOPED_MUTEX_LOCK(lock, s->mutex, this_ethread());
s->restart_sending();
}
ink_assert(s != next);
@@ -1079,6 +1081,7 @@ Http2ConnectionState::restart_streams()
}
if (!s->is_closed() && s->get_state() ==
Http2StreamState::HTTP2_STREAM_STATE_HALF_CLOSED_REMOTE &&
std::min(this->client_rwnd, s->client_rwnd) > 0) {
+ SCOPED_MUTEX_LOCK(lock, s->mutex, this_ethread());
s->restart_sending();
}
@@ -1192,6 +1195,7 @@ Http2ConnectionState::update_initial_rwnd(Http2WindowSize
new_size)
{
// Update stream level window sizes
for (Http2Stream *s = stream_list.head; s; s = static_cast<Http2Stream
*>(s->link.next)) {
+ SCOPED_MUTEX_LOCK(lock, s->mutex, this_ethread());
s->client_rwnd = new_size -
(client_settings.get(HTTP2_SETTINGS_INITIAL_WINDOW_SIZE) - s->client_rwnd);
}
}
diff --git a/proxy/http2/Http2Stream.cc b/proxy/http2/Http2Stream.cc
index a328df8..f4c2994 100644
--- a/proxy/http2/Http2Stream.cc
+++ b/proxy/http2/Http2Stream.cc
@@ -588,8 +588,11 @@ Http2Stream::update_write_request(IOBufferReader
*buf_reader, int64_t write_len,
case PARSE_RESULT_DONE: {
this->response_header_done = true;
- // Send the response header back
- parent->connection_state.send_headers_frame(this);
+ {
+ SCOPED_MUTEX_LOCK(lock, parent->connection_state.mutex,
this_ethread());
+ // Send the response header back
+ parent->connection_state.send_headers_frame(this);
+ }
// See if the response is chunked. Set up the dechunking logic if it is
// Make sure to check if the chunk is complete and signal appropriately
@@ -652,6 +655,7 @@ void
Http2Stream::push_promise(URL &url, const MIMEField *accept_encoding)
{
Http2ClientSession *parent = static_cast<Http2ClientSession
*>(this->get_parent());
+ SCOPED_MUTEX_LOCK(lock, parent->connection_state.mutex, this_ethread());
parent->connection_state.send_push_promise_frame(this, url, accept_encoding);
}
@@ -661,10 +665,12 @@ Http2Stream::send_response_body(bool call_update)
Http2ClientSession *parent = static_cast<Http2ClientSession
*>(this->get_parent());
if (Http2::stream_priority_enabled) {
+ SCOPED_MUTEX_LOCK(lock, parent->connection_state.mutex, this_ethread());
parent->connection_state.schedule_stream(this);
// signal_write_event() will be called from
`Http2ConnectionState::send_data_frames_depends_on_priority()`
// when write_vio is consumed
} else {
+ SCOPED_MUTEX_LOCK(lock, parent->connection_state.mutex, this_ethread());
parent->connection_state.send_data_frames(this);
this->signal_write_event(call_update);
}
--
To stop receiving notification emails like this one, please contact
[email protected].