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

remote write: reloading config with modified queue parameters results in duplicate metric registration #7451

Closed
beorn7 opened this issue Jun 24, 2020 · 3 comments

Comments

@beorn7
Copy link
Member

beorn7 commented Jun 24, 2020

What did you do?

Changed remote write queue_config fields like max_shards, capacity, max_samples_per_send.
SIGHUP'd the server.

What did you expect to see?

New config to be applied.

What did you see instead? Under which circumstances?

A panic.

After the following restart, the server came back OK. It's just that with a runtime config reload, the metrics of the new remote write queues collide with the old metrics.

Somehow, the unregister call added in #7188 isn't called in time or doesn't work as expected.

Environment

  • Prometheus version:

    2.19.1

  • Logs:

2020-06-24 15:02:25	
	/app/vendor/github.com/oklog/run/group.go:37 +0xbb
2020-06-24 15:02:25	
created by github.com/oklog/run.(*Group).Run
2020-06-24 15:02:25	
	/app/vendor/github.com/oklog/run/group.go:38 +0x27
2020-06-24 15:02:25	
github.com/oklog/run.(*Group).Run.func1(0xc000b001e0, 0xc000b00120, 0xc000912000)
2020-06-24 15:02:25	
	/app/cmd/prometheus/main.go:607 +0x1ec
2020-06-24 15:02:25	
main.main.func14(0x0, 0x0)
2020-06-24 15:02:25	
	/app/cmd/prometheus/main.go:817 +0x262
2020-06-24 15:02:25	
main.reloadConfig(0x7fffeda61ddc, 0x1e, 0x2f3b7e0, 0xc000c72cc0, 0xc000620340, 0x8, 0x8, 0x0, 0x0)
2020-06-24 15:02:25	
	/app/storage/remote/storage.go:77 +0xa6
2020-06-24 15:02:25	
github.com/prometheus/prometheus/storage/remote.(*Storage).ApplyConfig(0xc000188100, 0xc3d026fc00, 0x0, 0x0)
2020-06-24 15:02:25	
	/app/storage/remote/write.go:141 +0x3eb
2020-06-24 15:02:25	
github.com/prometheus/prometheus/storage/remote.(*WriteStorage).ApplyConfig(0xc000bcaa00, 0xc3d026fc00, 0x0, 0x0)
2020-06-24 15:02:25	
	/app/storage/remote/queue_manager.go:181 +0x10f2
2020-06-24 15:02:25	
github.com/prometheus/prometheus/storage/remote.newQueueManagerMetrics(0x2f76760, 0xc00019e730, 0xc755015ec0, 0x13, 0xc9885a4100, 0x40, 0xc771a42301)
2020-06-24 15:02:25	
	/app/vendor/github.com/prometheus/client_golang/prometheus/registry.go:400 +0xad
2020-06-24 15:02:25	
github.com/prometheus/client_golang/prometheus.(*Registry).MustRegister(0xc00019e730, 0xc0921c6000, 0xe, 0xe)
2020-06-24 15:02:25	
goroutine 75 [running]:
2020-06-24 15:02:25	

2020-06-24 15:02:25	
panic: duplicate metrics collector registration attempted
2020-06-24 15:02:25	
level=info ts=2020-06-24T13:02:25.313Z caller=main.go:799 msg="Loading configuration file" filename=/etc/prometheus/prometheus.yml

@csmarchbanks
Copy link
Member

@beorn7 I think I know what the issue is, but to make sure, did this only happen when you changed a remote write config that has a name? Or does it happen on queues with auto-generated names as well?

@beorn7
Copy link
Member Author

beorn7 commented Jun 24, 2020

The reported case happened with named queues. We currently do not have queues with auto-generated names. (I guess if the auto-generated name changes because of the parameter changes, then there won't be a problem because the name is part of the registration.)

@codesome
Copy link
Member

Fixed in #7452

@prometheus prometheus locked as resolved and limited conversation to collaborators Nov 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants