From 0a1102708420ef4995fa4c34c06e2160776d7b46 Mon Sep 17 00:00:00 2001 From: Sakthivel Subramanian Date: Tue, 3 Nov 2026 02:43:28 +0000 Subject: [PATCH 1/9] chore(kokoro): add Maven timeouts to prevent macOS VM hangs Injects Aether and Wagon read timeouts into MAVEN_OPTS inside retry_with_backoff to fail fast on Maven Central hangs instead of blocking for 3 hours. --- .kokoro/common.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.kokoro/common.sh b/.kokoro/common.sh index 84e36200685f..c7d22c61a822 100644 --- a/.kokoro/common.sh +++ b/.kokoro/common.sh @@ -52,6 +52,11 @@ function retry_with_backoff { shift 2 command=("$@") + # Add defensive timeouts to Maven commands to prevent Kokoro VM timeouts (10800s hang) + if [[ "${command[*]}" == *"mvn "* ]]; then + export MAVEN_OPTS="${MAVEN_OPTS} -Daether.connector.requestTimeout=300000 -Daether.connector.connectTimeout=30000 -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120" + fi + # store current flag state flags=$- From 4454e972bb47bb49b087486732ab2f1360c179a8 Mon Sep 17 00:00:00 2001 From: Sakthivel Subramanian Date: Tue, 3 Nov 2026 02:55:56 +0000 Subject: [PATCH 2/9] Addressed comments --- .kokoro/common.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.kokoro/common.sh b/.kokoro/common.sh index c7d22c61a822..2de05965b2cc 100644 --- a/.kokoro/common.sh +++ b/.kokoro/common.sh @@ -53,8 +53,10 @@ function retry_with_backoff { command=("$@") # Add defensive timeouts to Maven commands to prevent Kokoro VM timeouts (10800s hang) - if [[ "${command[*]}" == *"mvn "* ]]; then - export MAVEN_OPTS="${MAVEN_OPTS} -Daether.connector.requestTimeout=300000 -Daether.connector.connectTimeout=30000 -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120" + if [[ "${command[0]}" == "mvn" || "${command[0]}" == */mvn || "${command[0]}" == "mvnw" || "${command[0]}" == */mvnw ]]; then + if [[ "${MAVEN_OPTS}" != *"-Daether.connector.requestTimeout"* ]]; then + export MAVEN_OPTS="${MAVEN_OPTS} -Daether.connector.requestTimeout=300000 -Daether.connector.connectTimeout=30000 -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120" + fi fi # store current flag state From 6d7dac70411027dbe815b7bcf7f1039759e72ef8 Mon Sep 17 00:00:00 2001 From: Sakthivel Subramanian Date: Tue, 3 Nov 2026 03:08:48 +0000 Subject: [PATCH 3/9] Addressed comments --- .kokoro/common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.kokoro/common.sh b/.kokoro/common.sh index 2de05965b2cc..9baadd13ae38 100644 --- a/.kokoro/common.sh +++ b/.kokoro/common.sh @@ -54,8 +54,8 @@ function retry_with_backoff { # Add defensive timeouts to Maven commands to prevent Kokoro VM timeouts (10800s hang) if [[ "${command[0]}" == "mvn" || "${command[0]}" == */mvn || "${command[0]}" == "mvnw" || "${command[0]}" == */mvnw ]]; then - if [[ "${MAVEN_OPTS}" != *"-Daether.connector.requestTimeout"* ]]; then - export MAVEN_OPTS="${MAVEN_OPTS} -Daether.connector.requestTimeout=300000 -Daether.connector.connectTimeout=30000 -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120" + if [[ "${MAVEN_OPTS:-}" != *"-Daether.connector.requestTimeout"* ]]; then + export MAVEN_OPTS="${MAVEN_OPTS:-} -Daether.connector.requestTimeout=300000 -Daether.connector.connectTimeout=30000 -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120" fi fi From f692ab0701adfa552cbf2200b3a8dfec8505fccd Mon Sep 17 00:00:00 2001 From: Sakthivel Subramanian Date: Tue, 3 Nov 2026 03:21:30 +0000 Subject: [PATCH 4/9] Addressed comments --- .kokoro/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/common.sh b/.kokoro/common.sh index 9baadd13ae38..17af85d0c3ce 100644 --- a/.kokoro/common.sh +++ b/.kokoro/common.sh @@ -55,7 +55,7 @@ function retry_with_backoff { # Add defensive timeouts to Maven commands to prevent Kokoro VM timeouts (10800s hang) if [[ "${command[0]}" == "mvn" || "${command[0]}" == */mvn || "${command[0]}" == "mvnw" || "${command[0]}" == */mvnw ]]; then if [[ "${MAVEN_OPTS:-}" != *"-Daether.connector.requestTimeout"* ]]; then - export MAVEN_OPTS="${MAVEN_OPTS:-} -Daether.connector.requestTimeout=300000 -Daether.connector.connectTimeout=30000 -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120" + export MAVEN_OPTS="${MAVEN_OPTS:+"$MAVEN_OPTS "}-Daether.connector.requestTimeout=300000 -Daether.connector.connectTimeout=30000 -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120" fi fi From 261431aa2394258fa0f95b88f4c2634eaa3b32bf Mon Sep 17 00:00:00 2001 From: Sakthivel Subramanian Date: Tue, 3 Nov 2026 03:32:54 +0000 Subject: [PATCH 5/9] Addressed comments --- .kokoro/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/common.sh b/.kokoro/common.sh index 17af85d0c3ce..2269dd5c452c 100644 --- a/.kokoro/common.sh +++ b/.kokoro/common.sh @@ -55,7 +55,7 @@ function retry_with_backoff { # Add defensive timeouts to Maven commands to prevent Kokoro VM timeouts (10800s hang) if [[ "${command[0]}" == "mvn" || "${command[0]}" == */mvn || "${command[0]}" == "mvnw" || "${command[0]}" == */mvnw ]]; then if [[ "${MAVEN_OPTS:-}" != *"-Daether.connector.requestTimeout"* ]]; then - export MAVEN_OPTS="${MAVEN_OPTS:+"$MAVEN_OPTS "}-Daether.connector.requestTimeout=300000 -Daether.connector.connectTimeout=30000 -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120" + export MAVEN_OPTS="${MAVEN_OPTS:+"$MAVEN_OPTS "}-Daether.connector.requestTimeout=300000 -Daether.connector.connectTimeout=30000 -Dmaven.wagon.rto=300000 -Dmaven.wagon.connectionTimeout=30000 -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120" fi fi From 1f9f66aa575fc225d9823f26fc21e2a7eb89a361 Mon Sep 17 00:00:00 2001 From: Sakthivel Subramanian Date: Tue, 3 Nov 2026 03:44:07 +0000 Subject: [PATCH 6/9] Addressed comments --- .kokoro/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/common.sh b/.kokoro/common.sh index 2269dd5c452c..64a60e5673ea 100644 --- a/.kokoro/common.sh +++ b/.kokoro/common.sh @@ -53,7 +53,7 @@ function retry_with_backoff { command=("$@") # Add defensive timeouts to Maven commands to prevent Kokoro VM timeouts (10800s hang) - if [[ "${command[0]}" == "mvn" || "${command[0]}" == */mvn || "${command[0]}" == "mvnw" || "${command[0]}" == */mvnw ]]; then + if [[ "${command[0]:-}" == "mvn" || "${command[0]:-}" == */mvn || "${command[0]:-}" == "mvnw" || "${command[0]:-}" == */mvnw ]]; then if [[ "${MAVEN_OPTS:-}" != *"-Daether.connector.requestTimeout"* ]]; then export MAVEN_OPTS="${MAVEN_OPTS:+"$MAVEN_OPTS "}-Daether.connector.requestTimeout=300000 -Daether.connector.connectTimeout=30000 -Dmaven.wagon.rto=300000 -Dmaven.wagon.connectionTimeout=30000 -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120" fi From e7a72379b6a1bc7ed2722507c8b458e3e3a49845 Mon Sep 17 00:00:00 2001 From: Sakthivel Subramanian Date: Tue, 3 Nov 2026 03:55:22 +0000 Subject: [PATCH 7/9] Addressed comments --- .kokoro/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/common.sh b/.kokoro/common.sh index 64a60e5673ea..ee148c93f758 100644 --- a/.kokoro/common.sh +++ b/.kokoro/common.sh @@ -53,7 +53,7 @@ function retry_with_backoff { command=("$@") # Add defensive timeouts to Maven commands to prevent Kokoro VM timeouts (10800s hang) - if [[ "${command[0]:-}" == "mvn" || "${command[0]:-}" == */mvn || "${command[0]:-}" == "mvnw" || "${command[0]:-}" == */mvnw ]]; then + if [[ "${command[0]:-}" =~ (^|/)mvnw?$ ]]; then if [[ "${MAVEN_OPTS:-}" != *"-Daether.connector.requestTimeout"* ]]; then export MAVEN_OPTS="${MAVEN_OPTS:+"$MAVEN_OPTS "}-Daether.connector.requestTimeout=300000 -Daether.connector.connectTimeout=30000 -Dmaven.wagon.rto=300000 -Dmaven.wagon.connectionTimeout=30000 -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120" fi From 56d45f1cbf79e524f10610c1a835e1819a67291a Mon Sep 17 00:00:00 2001 From: Sakthivel Subramanian Date: Tue, 3 Nov 2026 04:06:41 +0000 Subject: [PATCH 8/9] Addressed comments --- .kokoro/common.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.kokoro/common.sh b/.kokoro/common.sh index ee148c93f758..55bcc44e6c92 100644 --- a/.kokoro/common.sh +++ b/.kokoro/common.sh @@ -53,7 +53,8 @@ function retry_with_backoff { command=("$@") # Add defensive timeouts to Maven commands to prevent Kokoro VM timeouts (10800s hang) - if [[ "${command[0]:-}" =~ (^|/)mvnw?$ ]]; then + local mvn_regex='(^|/)mvnw?$' + if [[ "${command[0]:-}" =~ $mvn_regex ]]; then if [[ "${MAVEN_OPTS:-}" != *"-Daether.connector.requestTimeout"* ]]; then export MAVEN_OPTS="${MAVEN_OPTS:+"$MAVEN_OPTS "}-Daether.connector.requestTimeout=300000 -Daether.connector.connectTimeout=30000 -Dmaven.wagon.rto=300000 -Dmaven.wagon.connectionTimeout=30000 -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120" fi From 6efc7f92cab1c14e487aead2eaba19ba0c1b111a Mon Sep 17 00:00:00 2001 From: Sakthivel Subramanian Date: Tue, 3 Nov 2026 04:17:52 +0000 Subject: [PATCH 9/9] Addressed comments --- .kokoro/common.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.kokoro/common.sh b/.kokoro/common.sh index 55bcc44e6c92..cc937e2292d1 100644 --- a/.kokoro/common.sh +++ b/.kokoro/common.sh @@ -56,7 +56,13 @@ function retry_with_backoff { local mvn_regex='(^|/)mvnw?$' if [[ "${command[0]:-}" =~ $mvn_regex ]]; then if [[ "${MAVEN_OPTS:-}" != *"-Daether.connector.requestTimeout"* ]]; then - export MAVEN_OPTS="${MAVEN_OPTS:+"$MAVEN_OPTS "}-Daether.connector.requestTimeout=300000 -Daether.connector.connectTimeout=30000 -Dmaven.wagon.rto=300000 -Dmaven.wagon.connectionTimeout=30000 -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120" + local -x MAVEN_OPTS="${MAVEN_OPTS:+"$MAVEN_OPTS "}-Daether.connector.requestTimeout=300000" + MAVEN_OPTS+=" -Daether.connector.connectTimeout=30000" + MAVEN_OPTS+=" -Dmaven.wagon.rto=300000" + MAVEN_OPTS+=" -Dmaven.wagon.connectionTimeout=30000" + MAVEN_OPTS+=" -Dmaven.wagon.http.retryHandler.class=standard" + MAVEN_OPTS+=" -Dmaven.wagon.http.retryHandler.count=3" + MAVEN_OPTS+=" -Dmaven.wagon.httpconnectionManager.ttlSeconds=120" fi fi