set SO_LINGER=0 to TCP connection
Closing TCP socket after every probe may cause large numbers of connections sitting in the TIME_WAIT state Relevant Issue: #794
set SO_LINGER=0 to avoid problem above Reference: https://stackoverflow.com/questions/3757289/when-is-tcp-option-so-linger-0-required
I tried to reproduce the situation reported in the issue and I couldn't. I don't see connections in the TIME_WAIT state. Would it be possible for you to provide more details as to how to reproduce this?
I'm hesitant to simply reset TCP connections from the client side instead of closing them in an orderly fashion.
- run blackbox_exporter with file blackbox.yml version=0.25.0, branch=HEAD, revision=ef3ff4fef195333fb8ee0039fb487b2f5007908f
docker run -d --rm -p 9115:9115 --name blackbox_exporter -v $(pwd):/config quay.io/prometheus/blackbox-exporter:latest --config.file=/config/blackbox.yml
- run prometheus
docker run -d --network host --rm --name prometheus -v $(pwd)/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
configuration file:
global:
scrape_interval: 5s
scrape_configs:
- job_name: 'blackbox'
metrics_path: /probe
params:
module: [http_2xx]
static_configs:
- targets:
- https://prometheus.io
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 127.0.0.1:9115
- wait several minutes, check tcp connection state of blackbox_exporter container
docker exec blackbox_exporter netstat -tnp
Hi 👋🏼, coming from the cleanup 🧹
This PR is quite old so I am going to close this, please feel free to reopen if you want to update it, and discuss it further.