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

[ BUG ] nil target item cause prometheus exit #3074

Closed
Colstuwjx opened this Issue Aug 15, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@Colstuwjx
Copy link
Contributor

Colstuwjx commented Aug 15, 2017

What did you do?
using a file sd to define the target groups.

What did you expect to see?
wrong discovery data should be skipped or warning, not panic.

What did you see instead? Under which circumstances?
panic, and the details is:

INFO[0000] Starting target manager...                    source="targetmanager.go:63"

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

goroutine 52 [running]:
github.com/prometheus/prometheus/discovery/file.readFile(0xc42015e2a0, 0x1b, 0x1, 0x1, 0xc420b4a270, 0x3, 0x3)
	/Users/Jacky/Jacky.Wu/MyProjects/Go/src/github.com/prometheus/prometheus/discovery/file/file.go:259 +0x1ea
github.com/prometheus/prometheus/discovery/file.(*Discovery).refresh(0xc420b28080, 0x3ea2080, 0xc420b28100, 0xc42001d620)
	/Users/Jacky/Jacky.Wu/MyProjects/Go/src/github.com/prometheus/prometheus/discovery/file/file.go:196 +0xfe
github.com/prometheus/prometheus/discovery/file.(*Discovery).Run(0xc420b28080, 0x3ea2080, 0xc420b28100, 0xc42001d620)
	/Users/Jacky/Jacky.Wu/MyProjects/Go/src/github.com/prometheus/prometheus/discovery/file/file.go:121 +0x198
created by github.com/prometheus/prometheus/discovery.(*TargetSet).updateProviders
	/Users/Jacky/Jacky.Wu/MyProjects/Go/src/github.com/prometheus/prometheus/discovery/discovery.go:249 +0x283

Environment

  • System information:

    Linux 3.16.0-4-amd64 x86_64

  • Prometheus version:

 prometheus, version 1.6.0 (branch: master, revision: 10f645382988add09c8e3420d0d7ff2dc4d36a29)
  build user:       root@0816a56aa81c
  build date:       20170414-18:36:18
  go version:       go1.8.1
  • Alertmanager version:

  • Prometheus configuration file:

...
  - job_name: 'nil-item-array-json-job'
    metrics_path: /metrics
    file_sd_configs:
      - files:
         - "invalid_nil_item_array.json"
# invalid_nil_item_array.json
# !!! the last null line caused panic!

[
    {
        "labels": {
            "env": "prod"
        },
        "targets": [
            "localhost:9090"
        ]
    },
    null
]
@lock

This comment has been minimized.

Copy link

lock bot commented Mar 23, 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 23, 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.