From 75324f38179ce966a9a767c0da997eaed756ea93 Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Fri, 10 Sep 2021 12:45:16 +1000 Subject: [PATCH] Cleanup metrics connections after idle timeout (#2748) When the prometheus service restarts, connections can be left open and never closed. These connections should close after an idle timeout to avoid causing issues with running out of ports. Signed-off-by: Paul Harris Signed-off-by: Adrian Sutton --- CHANGELOG.md | 3 ++- .../besu/metrics/prometheus/MetricsHttpService.java | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 59e249d488..8e4b88d395 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,8 @@ ### Bug Fixes - Consider effective price and effective priority fee in transaction replacement rules [\#2529](https://github.com/hyperledger/besu/issues/2529) -- GetTransactionCount should return the latest transaction count if it is greater than the transaction pool [\#2633](https://github.com/hyperledger/besu/pull/2633) +- GetTransactionCount should return the latest transaction count if it is greater than the transaction pool [\#2633](https://github.com/hyperledger/besu/pull/2633) +- Set an idle timeout for metrics connections, to clean up ports when no longer used [\#2748](https://github.com/hyperledger/besu/pull/2748) ### Early Access Features diff --git a/metrics/core/src/main/java/org/hyperledger/besu/metrics/prometheus/MetricsHttpService.java b/metrics/core/src/main/java/org/hyperledger/besu/metrics/prometheus/MetricsHttpService.java index 82afd0b3c3..c18565fcbd 100644 --- a/metrics/core/src/main/java/org/hyperledger/besu/metrics/prometheus/MetricsHttpService.java +++ b/metrics/core/src/main/java/org/hyperledger/besu/metrics/prometheus/MetricsHttpService.java @@ -84,6 +84,7 @@ public class MetricsHttpService implements MetricsService { new HttpServerOptions() .setHost(config.getHost()) .setPort(config.getPort()) + .setIdleTimeout(60) .setHandle100ContinueAutomatically(true) .setCompressionSupported(true));