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

Prometheus crashes when service discovery configuration is nil/null #4902

Closed
simonpasquier opened this Issue Nov 23, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@simonpasquier
Copy link
Member

simonpasquier commented Nov 23, 2018

Prometheus panics with the following configuration snippets:

- job_name: foo
  azure_sd_configs:
  - 
- job_name: bar
  kubernetes_sd_configs:
  - null

Logs:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x58 pc=0x8f0589]

goroutine 180 [running]:
github.com/prometheus/prometheus/discovery/azure.NewDiscovery(0x0, 0x1e2c580, 0xc005756690, 0x2)                                                                                             
        /home/simon/workspace/src/github.com/prometheus/prometheus/discovery/azure/azure.go:120 +0x109                                                                                       
github.com/prometheus/prometheus/discovery.(*Manager).registerProviders.func12(0x18c5320, 0x0, 0x17ef620, 0xc000525390)                                                                      
        /home/simon/workspace/src/github.com/prometheus/prometheus/discovery/manager.go:394 +0xba                                                                                            
github.com/prometheus/prometheus/discovery.(*Manager).registerProviders.func1(0x18c5320, 0x0, 0xc005754b00)                                                                                  
        /home/simon/workspace/src/github.com/prometheus/prometheus/discovery/manager.go:326 +0x229                                                                                           
github.com/prometheus/prometheus/discovery.(*Manager).registerProviders(0xc000374a00, 0xc003222428, 0x1, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)                                             
        /home/simon/workspace/src/github.com/prometheus/prometheus/discovery/manager.go:393 +0xd5a                                                                                           
github.com/prometheus/prometheus/discovery.(*Manager).ApplyConfig(0xc000374a00, 0xc00573fb30, 0x0, 0x0)                                                                                      
        /home/simon/workspace/src/github.com/prometheus/prometheus/discovery/manager.go:191 +0x335                                                                                           
main.main.func2(0xc00323af00, 0x0, 0x0)
        /home/simon/workspace/src/github.com/prometheus/prometheus/cmd/prometheus/main.go:346 +0x18a                                                                                         
main.reloadConfig(0x1bc01f6, 0xe, 0x1e2c580, 0xc0005559e0, 0xc000171b40, 0x7, 0x7, 0x0, 0x0)
        /home/simon/workspace/src/github.com/prometheus/prometheus/cmd/prometheus/main.go:653 +0x228                                                                                         
main.main.func16(0x0, 0x0)
        /home/simon/workspace/src/github.com/prometheus/prometheus/cmd/prometheus/main.go:527 +0x17e                                                                                         
github.com/prometheus/prometheus/vendor/github.com/oklog/oklog/pkg/group.(*Group).Run.func1(0xc0000a4f60, 0xc0000a4f00, 0xc00003b070)                                                        
        /home/simon/workspace/src/github.com/prometheus/prometheus/vendor/github.com/oklog/oklog/pkg/group/group.go:38 +0x27                                                                 
created by github.com/prometheus/prometheus/vendor/github.com/oklog/oklog/pkg/group.(*Group).Run                                                                                             
        /home/simon/workspace/src/github.com/prometheus/prometheus/vendor/github.com/oklog/oklog/pkg/group/group.go:37 +0xbe   
@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Dec 3, 2018

The same happens for an empty scrape_config section and probably other sections as well.

@juliusv

This comment has been minimized.

Copy link
Member

juliusv commented Dec 3, 2018

Heads-up: I'm fixing all the slice-of-pointers config nil pointer crashes in one go, so this will be covered by that.

juliusv added a commit that referenced this issue Dec 3, 2018

Fix config loading panics on nil pointer slice elements
Fixes #4902
Fixes #4889

Signed-off-by: Julius Volz <julius.volz@gmail.com>

@juliusv juliusv closed this in #4942 Dec 3, 2018

juliusv added a commit that referenced this issue Dec 3, 2018

Fix config loading panics on nil pointer slice elements (#4942)
Fixes #4902
Fixes #4889

Signed-off-by: Julius Volz <julius.volz@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.