You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2019/01/08 01:32:26 UTC

[trafficserver] branch master updated: Acquire a lock before checking H2ConnectionState::ua_session

This is an automated email from the ASF dual-hosted git repository.

maskit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new f516ff8  Acquire a lock before checking H2ConnectionState::ua_session
f516ff8 is described below

commit f516ff88f955f28af2dc296d670e4e77fbe27d5b
Author: Masakazu Kitajo <ma...@apache.org>
AuthorDate: Fri Dec 21 12:06:25 2018 +0900

    Acquire a lock before checking H2ConnectionState::ua_session
---
 proxy/http2/Http2ConnectionState.cc | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/proxy/http2/Http2ConnectionState.cc b/proxy/http2/Http2ConnectionState.cc
index a7cf6e7..4df6e85 100644
--- a/proxy/http2/Http2ConnectionState.cc
+++ b/proxy/http2/Http2ConnectionState.cc
@@ -1242,13 +1242,9 @@ Http2ConnectionState::release_stream(Http2Stream *stream)
     --total_client_streams_count;
   }
 
-  if (ua_session) {
-    SCOPED_MUTEX_LOCK(lock, this->ua_session->mutex, this_ethread());
-    if (!ua_session) {
-      // Workaround fix for GitHub #4504. The `ua_session` could be freed while waiting for acquiring the above lock.
-      return;
-    }
-
+  SCOPED_MUTEX_LOCK(lock, this->mutex, this_ethread());
+  if (this->ua_session) {
+    ink_assert(this->mutex == ua_session->mutex);
     // If the number of clients is 0 and ua_session is active, then mark the connection as inactive
     if (total_client_streams_count == 0 && ua_session->is_active()) {
       ua_session->clear_session_active();