Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frequent config reloading cause multi connection of same target #3577

Closed
ZeeShen opened this Issue Dec 12, 2017 · 6 comments

Comments

Projects
None yet
3 participants
@ZeeShen
Copy link

ZeeShen commented Dec 12, 2017

I set a cron job that check prometheus config repo and SIGHUP prometheus when config changes.

A bug in the job cause prometheus reloading config every minute. Then prometheus kept logging
error like too many open files.

image
↑ Open fd and goroutine count increasing after setting ulimit to 4096, target count 700+, avg scrape duration 60ms.

Then I found most of these opening fds were socket files. And with netstat, I found prometheus kept several(like 5 or 6) ESTABLISHED connections with same targets.

Not familiar with the code base but it might be helpful to check here that scrape pool will start new scrape loops when config changes. Maybe something wrong with scrape loop's run or stop?

I fixed the cron job and prometheus is running correctly now(open fd 600+, socket 500+). But I think maybe the prometheus server should deal with this frequent reloading situation. Or maybe something wrong with my configuration?

Environment

  • System information:

Linux 4.4.0-62-generic x86_64

  • Prometheus version:
  build user:       root@615b82cb36b6
  build date:       20171108-07:11:59
  go version:       go1.9.2

running with
--storage.tsdb.path=/mnt/prometheus --config.file=/xxx/prometheus.yml --storage.tsdb.retention=360h

and the prometheus.yaml is kinda big, main part is an ec2-sd and a file-sd of static targets.

@gouthamve

This comment has been minimized.

Copy link
Member

gouthamve commented Dec 12, 2017

#2830 Should fix this. Will get around to it soon.

@ZeeShen

This comment has been minimized.

Copy link
Author

ZeeShen commented Dec 13, 2017

Reloading only when config changes is a good solution for my case.

But what if the config is actually changes and should be reloaded frequently? Like add or remove some targets every minute, most targets remains unchanged and this multi-connection may still happen?

@gouthamve

This comment has been minimized.

Copy link
Member

gouthamve commented Dec 13, 2017

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Jun 13, 2018

Is this still happening?

@ZeeShen

This comment has been minimized.

Copy link
Author

ZeeShen commented Jul 18, 2018

We gave prometheus a BIG fd limit to avoid such too many open files error. Will open new issue if we found this happen again.

@ZeeShen ZeeShen closed this Jul 18, 2018

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 22, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 22, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.