[trafficserver] branch master updated: Track thread changes during origin connect and cache open write (#6872)

2020-06-11 Thread sudheerv
This is an automated email from the ASF dual-hosted git repository.

sudheerv 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 59c5e25  Track thread changes during origin connect and cache open 
write (#6872)
59c5e25 is described below

commit 59c5e25846b0dfe8720b5027fecac72af2da1545
Author: Sudheer Vinukonda 
AuthorDate: Thu Jun 11 22:29:57 2020 -0700

Track thread changes during origin connect and cache open write (#6872)

Also make adjust_thread() inline as an optimization
---
 proxy/ProxyTransaction.cc | 17 -
 proxy/ProxyTransaction.h  | 17 +
 proxy/http/HttpConfig.cc  |  6 ++
 proxy/http/HttpConfig.h   |  3 +++
 proxy/http/HttpSM.cc  |  2 ++
 5 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/proxy/ProxyTransaction.cc b/proxy/ProxyTransaction.cc
index 3f824e0..9be892f 100644
--- a/proxy/ProxyTransaction.cc
+++ b/proxy/ProxyTransaction.cc
@@ -83,23 +83,6 @@ ProxyTransaction::destroy()
   this->mutex.clear();
 }
 
-// See if we need to schedule on the primary thread for the transaction or 
change the thread that is associated with the VC.
-// If we reschedule, the scheduled action is returned.  Otherwise, NULL is 
returned
-Action *
-ProxyTransaction::adjust_thread(Continuation *cont, int event, void *data)
-{
-  NetVConnection *vc   = this->get_netvc();
-  EThread *this_thread = this_ethread();
-  if (vc && vc->thread != this_thread) {
-if (vc->thread->is_event_type(ET_NET)) {
-  return vc->thread->schedule_imm(cont, event, data);
-} else { // Not a net thread, take over this thread
-  vc->thread = this_thread;
-}
-  }
-  return nullptr;
-}
-
 void
 ProxyTransaction::set_rx_error_code(ProxyError e)
 {
diff --git a/proxy/ProxyTransaction.h b/proxy/ProxyTransaction.h
index 51f35db..83a2111 100644
--- a/proxy/ProxyTransaction.h
+++ b/proxy/ProxyTransaction.h
@@ -221,3 +221,20 @@ ProxyTransaction::support_sni() const
 {
   return _proxy_ssn ? _proxy_ssn->support_sni() : false;
 }
+
+// See if we need to schedule on the primary thread for the transaction or 
change the thread that is associated with the VC.
+// If we reschedule, the scheduled action is returned.  Otherwise, NULL is 
returned
+inline Action *
+ProxyTransaction::adjust_thread(Continuation *cont, int event, void *data)
+{
+  NetVConnection *vc   = this->get_netvc();
+  EThread *this_thread = this_ethread();
+  if (vc && vc->thread != this_thread) {
+if (vc->thread->is_event_type(ET_NET)) {
+  return vc->thread->schedule_imm(cont, event, data);
+} else { // Not a net thread, take over this thread
+  vc->thread = this_thread;
+}
+  }
+  return nullptr;
+}
diff --git a/proxy/http/HttpConfig.cc b/proxy/http/HttpConfig.cc
index 4f00b34..0c51d04 100644
--- a/proxy/http/HttpConfig.cc
+++ b/proxy/http/HttpConfig.cc
@@ -942,6 +942,12 @@ register_stat_callbacks()
  (int)http_origin_connections_throttled_stat, 
RecRawStatSyncCount);
   RecRegisterRawStat(http_rsb, RECT_PROCESS, 
"proxy.process.http.post_body_too_large", RECD_COUNTER, RECP_PERSISTENT,
  (int)http_post_body_too_large, RecRawStatSyncCount);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, 
"proxy.process.http.origin.connect.adjust_thread", RECD_COUNTER, 
RECP_NON_PERSISTENT,
+ (int)http_origin_connect_adjust_thread_stat, 
RecRawStatSyncCount);
+  HTTP_CLEAR_DYN_STAT(http_origin_connect_adjust_thread_stat);
+  RecRegisterRawStat(http_rsb, RECT_PROCESS, 
"proxy.process.http.cache.open_write.adjust_thread", RECD_COUNTER, 
RECP_NON_PERSISTENT,
+ (int)http_cache_open_write_adjust_thread_stat, 
RecRawStatSyncCount);
+  HTTP_CLEAR_DYN_STAT(http_cache_open_write_adjust_thread_stat);
   // milestones
   RecRegisterRawStat(http_rsb, RECT_PROCESS, 
"proxy.process.http.milestone.ua_begin", RECD_COUNTER, RECP_PERSISTENT,
  (int)http_ua_begin_time_stat, RecRawStatSyncSum);
diff --git a/proxy/http/HttpConfig.h b/proxy/http/HttpConfig.h
index ed0fcce..980c629 100644
--- a/proxy/http/HttpConfig.h
+++ b/proxy/http/HttpConfig.h
@@ -328,6 +328,9 @@ enum {
 
   http_origin_connections_throttled_stat,
 
+  http_origin_connect_adjust_thread_stat,
+  http_cache_open_write_adjust_thread_stat,
+
   http_stat_count
 };
 
diff --git a/proxy/http/HttpSM.cc b/proxy/http/HttpSM.cc
index 6dfbe23..323564f 100644
--- a/proxy/http/HttpSM.cc
+++ b/proxy/http/HttpSM.cc
@@ -2451,6 +2451,7 @@ HttpSM::state_cache_open_write(int event, void *data)
   pending_action->cancel();
 }
 if ((pending_action = ua_txn->adjust_thread(this, event, data))) {
+  HTTP_INCREMENT_DYN_STAT(http_cache_open_write_adjust_thread_stat);
   return 0; // Go away if we reschedule
 }
   }
@@ -4818,6 +4819,7 @@ HttpSM::do_http_server_open(bool raw)
   // Make sure we are on the "right" thread
   if 

[trafficserver] branch 9.0.x updated: Fix for Ubuntu 16 and Clang 5

2020-06-11 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new 16fc6ed  Fix for Ubuntu 16 and Clang 5
16fc6ed is described below

commit 16fc6edeb552fb33913dd40825bc02b067fff0e2
Author: Bryan Call 
AuthorDate: Tue Jun 9 16:04:58 2020 -0700

Fix for Ubuntu 16 and Clang 5

(cherry picked from commit 0fd49c414bd1ff6b7819d31fcd3dcb7cddf20a81)
---
 src/tscore/ink_res_init.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/tscore/ink_res_init.cc b/src/tscore/ink_res_init.cc
index be4dccc..18bea6e 100644
--- a/src/tscore/ink_res_init.cc
+++ b/src/tscore/ink_res_init.cc
@@ -93,7 +93,8 @@
 #define isascii(c) (!(c & 0200))
 #endif
 
-HostResPreferenceOrder const HOST_RES_DEFAULT_PREFERENCE_ORDER = 
{HOST_RES_PREFER_IPV4, HOST_RES_PREFER_IPV6, HOST_RES_PREFER_NONE};
+HostResPreferenceOrder const HOST_RES_DEFAULT_PREFERENCE_ORDER = {
+  {HOST_RES_PREFER_IPV4, HOST_RES_PREFER_IPV6, HOST_RES_PREFER_NONE}};
 
 HostResPreferenceOrder host_res_default_preference_order;
 



[trafficserver] branch 9.0.x updated: Fix set manipulation in dual cert resolution (#6758)

2020-06-11 Thread bcall
This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
 new e67245a  Fix set manipulation in dual cert resolution (#6758)
e67245a is described below

commit e67245a34cc87c92315e493c4c4283c3d81fe065
Author: Susan Hinrichs 
AuthorDate: Tue May 12 10:35:09 2020 -0500

Fix set manipulation in dual cert resolution (#6758)

Co-authored-by: Susan Hinrichs 
(cherry picked from commit cc1376fff1bcbda7329d21c22e8cb8ecdaad3950)
---
 iocore/net/SSLUtils.cc | 13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/iocore/net/SSLUtils.cc b/iocore/net/SSLUtils.cc
index 8c283e7..5dfcd69 100644
--- a/iocore/net/SSLUtils.cc
+++ b/iocore/net/SSLUtils.cc
@@ -1997,23 +1997,26 @@ 
SSLMultiCertConfigLoader::load_certs_and_cross_reference_names(std::vector new_set;
-new_set.insert(name);
+new_set.insert(*common_iter);
 unique_names.insert({cert_index - 1, new_set});
   } else {
-iter->second.insert(name);
+iter->second.insert(*common_iter);
   }
-  auto erase_iter = common_names.find(name);
+  auto erase_iter = common_iter;
+  ++common_iter;
   common_names.erase(erase_iter);
 } else {
   // New name already in common set, go ahead and remove it from 
further consideration
   name_set.erase(iter);
+  ++common_iter;
 }
   }
   // Anything still in name_set was not in common_names



[trafficserver] branch master updated: Fix for Ubuntu 16 and Clang 5

2020-06-11 Thread bcall
This is an automated email from the ASF dual-hosted git repository.

bcall 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 0fd49c4  Fix for Ubuntu 16 and Clang 5
0fd49c4 is described below

commit 0fd49c414bd1ff6b7819d31fcd3dcb7cddf20a81
Author: Bryan Call 
AuthorDate: Tue Jun 9 16:04:58 2020 -0700

Fix for Ubuntu 16 and Clang 5
---
 src/tscore/ink_res_init.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/tscore/ink_res_init.cc b/src/tscore/ink_res_init.cc
index 26b8533..42638a8 100644
--- a/src/tscore/ink_res_init.cc
+++ b/src/tscore/ink_res_init.cc
@@ -93,7 +93,8 @@
 #define isascii(c) (!(c & 0200))
 #endif
 
-HostResPreferenceOrder const HOST_RES_DEFAULT_PREFERENCE_ORDER = 
{HOST_RES_PREFER_IPV4, HOST_RES_PREFER_IPV6, HOST_RES_PREFER_NONE};
+HostResPreferenceOrder const HOST_RES_DEFAULT_PREFERENCE_ORDER = {
+  {HOST_RES_PREFER_IPV4, HOST_RES_PREFER_IPV6, HOST_RES_PREFER_NONE}};
 
 HostResPreferenceOrder host_res_default_preference_order;
 



[trafficserver] branch master updated: AuTest: port selection improvements. (#6888)

2020-06-11 Thread shinrich
This is an automated email from the ASF dual-hosted git repository.

shinrich 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 ca031ab  AuTest: port selection improvements. (#6888)
ca031ab is described below

commit ca031ab036465a2e17454c0cd69bb7b8a69f479a
Author: Brian Neradt 
AuthorDate: Thu Jun 11 18:00:00 2020 -0500

AuTest: port selection improvements. (#6888)

This is an attempt to address AuTest port selection issues. This:

- Checks whether the port being delivered via the port queue is still
available. If not, the next port in the queue checked. This repeats
until an available port is found.

- Changes the port from a LIFO to a FIFO. As a LIFO, the port that was
used in a previous test and just released would be attempted to be used
again in the very next test. It could be that the port is still in a
WAIT state. I'm wondering whether this caused the address in use issues.
Changing to a FIFO should address this.

- Adds debug and verbose logging so we can get a view into the logic
being used. There's two methods of port selection, one that is preferred
and a fallback method using a bound socket with SO_REUSEADDR. If we are
still having issues after this change, I suggest we turn on verbose
logging in our CI which would reveal which method is used. Note that
verbose logging shouldn't be nearly as noisy as debug logging.

Co-authored-by: bneradt 
---
 tests/gold_tests/autest-site/ports.py | 166 +-
 1 file changed, 144 insertions(+), 22 deletions(-)

diff --git a/tests/gold_tests/autest-site/ports.py 
b/tests/gold_tests/autest-site/ports.py
index 7932be8..4f26871 100644
--- a/tests/gold_tests/autest-site/ports.py
+++ b/tests/gold_tests/autest-site/ports.py
@@ -31,8 +31,25 @@ except ImportError:
 g_ports = None  # ports we can use
 
 
+class PortQueueSelectionError(Exception):
+"""
+An exception for when there are problems selecting a port from the port
+queue.
+"""
+pass
+
+
 def PortOpen(port, address=None):
+"""
+Detect whether the port is open, that is a socket is currently using that 
port.
+
+Open ports are currently in use by an open socket and are therefore not 
available
+for a server to listen on them.
 
+Returns:
+True if there is a connection currently listening on the port, False if
+there is no server listening on the port currently.
+"""
 ret = False
 if address is None:
 address = "localhost"
@@ -40,25 +57,84 @@ def PortOpen(port, address=None):
 address = (address, port)
 
 try:
+# Try to connect on that port. If we can connect on it, then someone is
+# listening on that port and therefore the port is open.
 s = socket.create_connection(address, timeout=.5)
 s.close()
 ret = True
+host.WriteDebug(
+'PortOpen',
+"Connection to port {} succeeded, the port is open, "
+"and a future connection cannot use it".format(port))
 except socket.error:
 s = None
-ret = False
+host.WriteDebug(
+'PortOpen',
+"socket error for port {0}, port is closed, "
+"and therefore a future connection can use it".format(port))
 except socket.timeout:
 s = None
+host.WriteDebug(
+'PortOpen',
+"Timeout error for port {0}, port is closed, "
+"and therefore a future connection can use it".format(port))
 
 return ret
 
 
-def setup_port_queue(amount=1000):
+def _get_available_port(queue):
+"""
+Get the next available port from the port queue and return it.
+
+Since there can be a delay between when the queue is populated and when the
+port is requested, this checks the next port in the queue to see whether it
+is still not open. If it isn't, it is dropped from the queue and the next
+one is inspected. This process continues until either an available port is
+found, or, if the queue is exhausted, PortQueueSelectionError is raised.
+
+Returns:
+An available (i.e., non-open) port.
+
+Throws:
+PortQueueSelectionError if the port queue is exhausted.
+"""
+
+if queue.qsize() == 0:
+host.WriteWarning("Port queue is empty.")
+raise PortQueueSelectionError(
+"Could not get a valid port because the queue is empty")
+
+port = queue.get()
+while PortOpen(port):
+host.WriteDebug(
+'_get_available_port'
+"Port was open but now is used: {}".format(port))
+if queue.qsize() == 0:
+host.WriteWarning("Port queue is empty.")
+raise PortQueueSelectionError(
+"Could not get a valid port because the queue is empty")
+

[trafficserver] branch 8.1.x updated: cache_range_request: Overhaul and clean up the core autest. (#6848)

2020-06-11 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 8.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/8.1.x by this push:
 new 2d425c1  cache_range_request: Overhaul and clean up the core autest. 
(#6848)
2d425c1 is described below

commit 2d425c16e547f5aa02854be3e796ca1760866f47
Author: Brian Olsen 
AuthorDate: Thu Jun 11 13:42:46 2020 -0600

cache_range_request: Overhaul and clean up the core autest. (#6848)

(cherry picked from commit de5f57036ae8ec84b2aa262eaac6a04ce0d6677f)
---
 .../cache_range_requests.test.py   | 39 +-
 .../cache_range_requests/gold/404.stdout.gold  |  8 -
 .../cache_range_requests/gold/frange.stderr.gold   |  1 -
 .../cache_range_requests/gold/frange.stdout.gold   | 10 --
 .../cache_range_requests/gold/full.stderr.gold |  2 +-
 .../cache_range_requests/gold/full.stdout.gold |  8 -
 .../cache_range_requests/gold/inner.stderr.gold|  2 +-
 .../cache_range_requests/gold/inner.stdout.gold| 10 --
 .../cache_range_requests/gold/last.stderr.gold |  2 +-
 .../cache_range_requests/gold/last.stdout.gold | 10 --
 .../cache_range_requests/gold/pselect.stdout.gold  | 10 --
 .../gold/pselect_none.stdout.gold  |  9 -
 12 files changed, 27 insertions(+), 84 deletions(-)

diff --git 
a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests.test.py 
b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests.test.py
index da4df7c..b252905 100644
--- 
a/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests.test.py
+++ 
b/tests/gold_tests/pluginTest/cache_range_requests/cache_range_requests.test.py
@@ -223,7 +223,6 @@ ps.StartBefore(server, 
ready=When.PortOpen(server.Variables.Port))
 ps.StartBefore(Test.Processes.ts, ready=When.PortOpen(ts.Variables.port))
 ps.Command = curl_and_args + ' http://www.example.com/path -H "uuid: full"'
 ps.ReturnCode = 0
-ps.Streams.stdout = "gold/full.stdout.gold"
 ps.Streams.stderr = "gold/full.stderr.gold"
 tr.StillRunningAfter = ts
 
@@ -233,9 +232,9 @@ tr = Test.AddTestRun("inner range cache miss")
 ps = tr.Processes.Default
 ps.Command = curl_and_args + ' http://www.example.com/path -r {} -H "uuid: 
inner"'.format(inner_str)
 ps.ReturnCode = 0
-#ps.Streams.stdout = "gold/inner.stdout.gold"
 ps.Streams.stderr = "gold/inner.stderr.gold"
 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", 
"expected cache miss")
+ps.Streams.stdout.Content += Testers.ContainsExpression("Content-Range: bytes 
7-15/18", "expected content-range header")
 tr.StillRunningAfter = ts
 
 # 2 Test - Fetch from cache
@@ -243,9 +242,9 @@ tr = Test.AddTestRun("inner range cache hit")
 ps = tr.Processes.Default
 ps.Command = curl_and_args + ' http://www.example.com/path -r 
{}'.format(inner_str)
 ps.ReturnCode = 0
-#ps.Streams.stdout = "gold/inner.stdout.gold"
 ps.Streams.stderr = "gold/inner.stderr.gold"
 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit", 
"expected cache hit")
+ps.Streams.stdout.Content += Testers.ContainsExpression("Content-Range: bytes 
7-15/18", "expected content-range header")
 tr.StillRunningAfter = ts
 
 # full range
@@ -255,9 +254,9 @@ tr = Test.AddTestRun("0- request miss")
 ps = tr.Processes.Default
 ps.Command = curl_and_args + ' http://www.example.com/path -r {} -H "uuid: 
frange"'.format(frange_str)
 ps.ReturnCode = 0
-#ps.Streams.stdout = "gold/frange.stdout.gold"
-ps.Streams.stderr = "gold/frange.stderr.gold"
+ps.Streams.stderr = "gold/full.stderr.gold"
 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", 
"expected cache miss")
+ps.Streams.stdout.Content += Testers.ContainsExpression("Content-Range: bytes 
0-18/18", "expected content-range header")
 tr.StillRunningAfter = ts
 
 # 4 Test - 0- request
@@ -265,9 +264,9 @@ tr = Test.AddTestRun("0- request hit")
 ps = tr.Processes.Default
 ps.Command = curl_and_args + ' http://www.example.com/path -r 
{}'.format(frange_str)
 ps.ReturnCode = 0
-#ps.Streams.stdout = "gold/frange.stdout.gold"
-ps.Streams.stderr = "gold/frange.stderr.gold"
+ps.Streams.stderr = "gold/full.stderr.gold"
 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: hit", 
"expected cache hit")
+ps.Streams.stdout.Content += Testers.ContainsExpression("Content-Range: bytes 
0-18/18", "expected content-range header")
 tr.StillRunningAfter = ts
 
 # end range
@@ -277,9 +276,9 @@ tr = Test.AddTestRun("-5 request miss")
 ps = tr.Processes.Default
 ps.Command = curl_and_args + ' http://www.example.com/path -r {} -H "uuid: 
last"'.format(last_str)
 ps.ReturnCode = 0
-#ps.Streams.stdout = "gold/last.stdout.gold"
 ps.Streams.stderr = "gold/last.stderr.gold"
 ps.Streams.stdout.Content = Testers.ContainsExpression("X-Cache: miss", 
"expected cache miss")
+ps.Streams.stdout.Content += 

[trafficserver] branch master updated (af9c4f3 -> 62d9105)

2020-06-11 Thread shinrich
This is an automated email from the ASF dual-hosted git repository.

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


from af9c4f3  Return null when  do_io_write called on closed stream (#6826)
 add 62d9105  Revert "Avoid stale client_vc (#6732)" (#6879)

No new revisions were added by this update.

Summary of changes:
 iocore/net/UnixNetVConnection.cc  |  2 --
 proxy/http/Http1ClientSession.cc  | 24 +---
 proxy/http/HttpSM.cc  | 12 ++--
 proxy/http2/Http2ClientSession.cc |  8 ++--
 proxy/http2/Http2Stream.cc|  5 ++---
 5 files changed, 31 insertions(+), 20 deletions(-)



[trafficserver-ingress-controller] branch master updated: Removes kubernetes for docker in README and replaces it with Minikube setup guide

2020-06-11 Thread kichan
This is an automated email from the ASF dual-hosted git repository.

kichan pushed a commit to branch master
in repository 
https://gitbox.apache.org/repos/asf/trafficserver-ingress-controller.git


The following commit(s) were added to refs/heads/master by this push:
 new 278ca2d  Removes kubernetes for docker in README and replaces it with 
Minikube setup guide
 new 20098bf  Merge pull request #5 from rishabhc/k8s-version-update
278ca2d is described below

commit 278ca2d46169ece589817b7d90864b20a3789d81
Author: Rishabh Chhabra 
AuthorDate: Wed Jun 10 14:46:31 2020 -0500

Removes kubernetes for docker in README and replaces it with Minikube setup 
guide
---
 README.md | 34 ++
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/README.md b/README.md
index fc86e46..e8e7f3d 100644
--- a/README.md
+++ b/README.md
@@ -78,11 +78,11 @@ As defined by 
[kubernetes/ingress-nginx](https://github.com/kubernetes/ingress-n
 
 ### Required Software
 - Docker
-- Kubernetes
+- Kubernetes (Minikube)
 
 To install Docker, visit its [official page](https://docs.docker.com/) and 
install the correct version for your system.
 
-The easiest way to get Kubernetes on a Mac is through Docker. Launch Docker on 
your machine and go to `Preferences -> Kubernetes`, Click `Enable Kubernetes` 
then `Apply`. Kubernetes will be enabled and starting.
+The walkthrough uses Minikube to guide you through the setup process. Visit 
the [official Minikube 
page](https://kubernetes.io/docs/tasks/tools/install-minikube/) to install 
Minikube. 
 
 ### Download project 
 If you are cloning this project for development, visit [Setting up 
Go-Lang](#setting-up-go-lang) for detailed guide on how to develop projects in 
Go. 
@@ -90,26 +90,28 @@ If you are cloning this project for development, visit 
[Setting up Go-Lang](#set
 For other purposes, you can use `git clone` or directly download repository to 
your computer.
 
 ### Example Walkthrough
-Once you have cloned the project repo and started Docker and Kubernetes, in 
the terminal:
-1. `$ cd trafficserver-ingress-controller`
-2. `$ docker build -t ats_alpine .` 
+Once you have cloned the project repo and started Docker and Minikube, in the 
terminal:
+1. `$ eval $(minikube docker-env)`
+  - To understand why we do this, please read [Use local images by 
re-using the docker 
daemon](https://kubernetes.io/docs/setup/learning-environment/minikube/#use-local-images-by-re-using-the-docker-daemon)
+2. `$ cd trafficserver-ingress-controller`
+3. `$ docker build -t ats_alpine .` 
  - wait for Docker finish building the image
-3. `$ docker build -t node-app-1 k8s/backend/node-app-1/`
+4. `$ docker build -t node-app-1 k8s/backend/node-app-1/`
  - wait for Docker finish building the image
-4. `$ docker build -t node-app-2 k8s/backend/node-app-2/`
+5. `$ docker build -t node-app-2 k8s/backend/node-app-2/`
  - wait for Docker finish building the image
 
 - At this point, we have created necessary images for our example. Let's talk 
about what each step does:
   - Step 2 builds an image to create a Docker container that will contain the 
Apache Traffic Server (ATS) itself, the kubernetes ingress controller, along 
with other software required for the controller to do its job.
   - Steps 3 and 4 builds 2 images that will serve as backends to [kubernetes 
services](https://kubernetes.io/docs/concepts/services-networking/service/) 
which we will shortly create
 
-5. `$ kubectl create namespace trafficserver-test`
+6. `$ kubectl create namespace trafficserver-test`
 - Create a namespace for ATS pod
-6. `$ openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout 
tls.key -out tls.crt -subj "/CN=atssvc/O=atssvc"`
+7. `$ openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout 
tls.key -out tls.crt -subj "/CN=atssvc/O=atssvc"`
 - Create a self-signed certificate
-7. `$ kubectl create secret tls tls-secret --key tls.key --cert tls.crt -n 
trafficserver-test --dry-run=client -o yaml | kubectl apply -f -`
+8. `$ kubectl create secret tls tls-secret --key tls.key --cert tls.crt -n 
trafficserver-test --dry-run=client -o yaml | kubectl apply -f -`
 - Create a secret in the namespace just created
-5. `$ kubectl apply -f k8s/traffic-server/`
+9. `$ kubectl apply -f k8s/traffic-server/`
 -  will define a new [kubernetes 
namespace](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/)
 named `trafficserver-test` and deploy a single ATS pod to said namespace. The 
ATS pod is also where the ingress controller lives. Additionally, this will 
expose your local machine's port `3` to the outside world.
 
  Proxy
@@ -134,11 +136,11 @@ When both steps _above_ have executed at least once, ATS 
proxying will have star
 
 In kubernetes, ingress resources are necessary to enable proxying since it is 
where domain names are defined. However, given _only_ domain names, ATS cannot 
proxy 

[trafficserver] branch 8.1.x updated: Revert "proxy.config.http.connect_attempts_timeout tracks TTBF instead of connect" (#6885)

2020-06-11 Thread zwoop
This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 8.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/8.1.x by this push:
 new b61044f  Revert "proxy.config.http.connect_attempts_timeout tracks 
TTBF instead of connect" (#6885)
b61044f is described below

commit b61044f9150e1a9d08c66ce3e7c770a4beac94a8
Author: Vijay Mamidi 
AuthorDate: Thu Jun 11 10:26:11 2020 -0700

Revert "proxy.config.http.connect_attempts_timeout tracks TTBF instead of 
connect" (#6885)

This reverts commit 3b5d77ac9a68edae297d6e5177de1f3b002a469e.
---
 iocore/net/I_NetProcessor.h   |  23 
 iocore/net/P_SSLNetVConnection.h  |  10 
 iocore/net/P_UnixNetVConnection.h |   6 --
 iocore/net/UnixNetProcessor.cc| 116 ++
 iocore/net/UnixNetVConnection.cc  |   8 ---
 proxy/http/HttpSM.cc  |  52 +
 6 files changed, 166 insertions(+), 49 deletions(-)

diff --git a/iocore/net/I_NetProcessor.h b/iocore/net/I_NetProcessor.h
index 570e7f3..142244b 100644
--- a/iocore/net/I_NetProcessor.h
+++ b/iocore/net/I_NetProcessor.h
@@ -176,6 +176,8 @@ public:
   call back with success. If this behaviour is desired use
   synchronous connect connet_s method.
 
+@see connect_s()
+
 @param cont Continuation to be called back with events.
 @param addr target address and port to connect to.
 @param options @see NetVCOptions.
@@ -185,6 +187,27 @@ public:
   inkcoreapi Action *connect_re(Continuation *cont, sockaddr const *addr, 
NetVCOptions *options = nullptr);
 
   /**
+Open a NetVConnection for connection oriented I/O. This call
+is simliar to connect method except that the cont is called
+back only after the connections has been established. In the
+case of connect the cont could be called back with NET_EVENT_OPEN
+event and OS could still be in the process of establishing the
+connection. Re-entrant Callbacks: same as connect. If unix
+asynchronous type connect is desired use connect_re().
+
+@param cont Continuation to be called back with events.
+@param addr Address to which to connect (includes port).
+@param timeout for connect, the cont will get NET_EVENT_OPEN_FAILED
+  if connection could not be established for timeout msecs. The
+  default is 30 secs.
+@param options @see NetVCOptions.
+
+@see connect_re()
+
+  */
+  Action *connect_s(Continuation *cont, sockaddr const *addr, int timeout = 
NET_CONNECT_TIMEOUT, NetVCOptions *opts = nullptr);
+
+  /**
 Initializes the net processor. This must be called before the event 
threads are started.
 
   */
diff --git a/iocore/net/P_SSLNetVConnection.h b/iocore/net/P_SSLNetVConnection.h
index 531abdb..e73f3fa 100644
--- a/iocore/net/P_SSLNetVConnection.h
+++ b/iocore/net/P_SSLNetVConnection.h
@@ -101,16 +101,6 @@ public:
   }
 
   bool
-  trackFirstHandshake() override
-  {
-bool retval = sslHandshakeBeginTime == 0;
-if (retval) {
-  sslHandshakeBeginTime = Thread::get_hrtime();
-}
-return retval;
-  }
-
-  bool
   getSSLHandShakeComplete() const override
   {
 return sslHandShakeComplete;
diff --git a/iocore/net/P_UnixNetVConnection.h 
b/iocore/net/P_UnixNetVConnection.h
index c6ea08d..1fef6b9 100644
--- a/iocore/net/P_UnixNetVConnection.h
+++ b/iocore/net/P_UnixNetVConnection.h
@@ -206,12 +206,6 @@ public:
 return (true);
   }
 
-  virtual bool
-  trackFirstHandshake()
-  {
-return false;
-  }
-
   virtual void net_read_io(NetHandler *nh, EThread *lthread);
   virtual int64_t load_buffer_and_write(int64_t towrite, MIOBufferAccessor 
, int64_t _written, int );
   void readDisable(NetHandler *nh);
diff --git a/iocore/net/UnixNetProcessor.cc b/iocore/net/UnixNetProcessor.cc
index d1ec316..3aac473 100644
--- a/iocore/net/UnixNetProcessor.cc
+++ b/iocore/net/UnixNetProcessor.cc
@@ -306,6 +306,122 @@ UnixNetProcessor::connect(Continuation *cont, 
UnixNetVConnection ** /* avc */, s
   return connect_re(cont, target, opt);
 }
 
+struct CheckConnect : public Continuation {
+  UnixNetVConnection *vc;
+  Action action_;
+  MIOBuffer *buf;
+  IOBufferReader *reader;
+  int connect_status;
+  int recursion;
+  ink_hrtime timeout;
+
+  int
+  handle_connect(int event, Event *e)
+  {
+connect_status = event;
+switch (event) {
+case NET_EVENT_OPEN:
+  vc = (UnixNetVConnection *)e;
+  Debug("iocore_net_connect", "connect Net open");
+  vc->do_io_write(this, 10, /* some non-zero number just to get the poll 
going */
+  reader);
+  /* dont wait for more than timeout secs */
+  vc->set_inactivity_timeout(timeout);
+  return EVENT_CONT;
+  break;
+
+case NET_EVENT_OPEN_FAILED:
+  Debug("iocore_net_connect", "connect Net open failed");
+  if (!action_.cancelled) {
+action_.continuation->handleEvent(NET_EVENT_OPEN_FAILED,