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

Fix bug in logql parsing that leads to crash. #2046

Merged
merged 2 commits into from
May 6, 2020

Commits on May 6, 2020

  1. Fix bug in logql parsing that leads to crash.

    ```
    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x20ae356]
    goroutine 39530021 [running]:
    github.com/grafana/loki/pkg/logql.andFilter.Filter(0x0, 0x0, 0x3beffc0, 0xc01f065bc0, 0xc01aaaec00, 0x13d, 0x200, 0xffffffffffffffff)
    	/src/loki/pkg/logql/filter.go:66 +0x26
    github.com/grafana/loki/pkg/chunkenc.(*bufferedIterator).Next(0xc00a48fba0, 0x0)
    	/src/loki/pkg/chunkenc/memchunk.go:616 +0x1cb
    github.com/grafana/loki/pkg/iter.(*nonOverlappingIterator).Next(0xc00130ae40, 0x0)
    	/src/loki/pkg/iter/iterator.go:438 +0x135
    github.com/grafana/loki/pkg/iter.(*timeRangedIterator).Next(0xc00130ae80, 0x0)
    	/src/loki/pkg/iter/iterator.go:497 +0x48
    github.com/grafana/loki/pkg/iter.(*reverseIterator).load(0xc00072ac40)
    	/src/loki/pkg/iter/iterator.go:555 +0x70
    github.com/grafana/loki/pkg/iter.(*reverseIterator).Next(0xc00072ac40, 0x0)
    	/src/loki/pkg/iter/iterator.go:563 +0x2f
    github.com/grafana/loki/pkg/iter.(*nonOverlappingIterator).Next(0xc00130af40, 0x10)
    	/src/loki/pkg/iter/iterator.go:438 +0x135
    ```
    
    This is caused by people doing `|= ""` which would result in parsing of
    TrueFilter but would be returned as nil.
    
    Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
    gouthamve committed May 6, 2020
    Configuration menu
    Copy the full SHA
    18270fd View commit details
    Browse the repository at this point in the history
  2. Add tests for the panic

    Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
    gouthamve committed May 6, 2020
    Configuration menu
    Copy the full SHA
    b43248a View commit details
    Browse the repository at this point in the history