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

Error handling for empty vellum data #150

Merged
merged 2 commits into from
May 4, 2023

Conversation

Thejas-bhat
Copy link
Member

@Thejas-bhat Thejas-bhat commented Mar 29, 2023

  • Handling this case will help in avoiding any downstream empty slice panics that might occur.
  • An example with respect to this panic is as follows:
panic: runtime error: index out of range [0] with length 0   
goroutine 1537342 [running]: github.com/blevesearch/vellum.(*fstStateV1).isEncodedSingle(...) 
/home/couchbase/.cbdepscache/gomodcache/pkg/mod/github.com/blevesearch/vellum@v1.0.8/decoder_v1.go:100 github.com/blevesearch/vellum.(*fstStateV1).TransitionFor(0xc014e04de0?, 0x40?) 
/home/couchbase/.cbdepscache/gomodcache/pkg/mod/github.com/blevesearch/vellum@v1.0.8/decoder_v1.go:239 +0x2d2 github.com/blevesearch/vellum.(*FST).get(0xc014e11cc0, {0xc01c7db558, 0x5, 0xc010531a68?}, {0x15cac98, 0xc01cb846e8}) 
/home/couchbase/.cbdepscache/gomodcache/pkg/mod/github.com/blevesearch/vellum@v1.0.8/fst.go:78 +0xd0 github.com/blevesearch/vellum.(*Reader).Get(...) 
/home/couchbase/.cbdepscache/gomodcache/pkg/mod/github.com/blevesearch/vellum@v1.0.8/fst.go:299 github.com/blevesearch/zapx/v15.(*Dictionary).postingsList(0xc01cb7cba0, {0xc01c7db558?, 0x1?, 0xc01358a500?}, 0xc0129bdd70?, 0xc01cb7b7c0) 
/home/couchbase/.cbdepscache/gomodcache/pkg/mod/github.com/blevesearch/zapx/v15@v15.3.4/dict.go:57 +0x88 github.com/blevesearch/zapx/v15.

This happens when the backend fst which is the term dictionary is loaded with an empty byte slice of data from the index file, and when we try to do a Get() on the fst, we would end up doing operations on the empty slice that causes a panic.

@Thejas-bhat Thejas-bhat marked this pull request as draft April 5, 2023 05:53
@abhinavdangeti
Copy link
Member

@Thejas-bhat Would you add some sample panics to the commit message^, for our reference.

@Thejas-bhat Thejas-bhat merged commit b63d83d into blevesearch:master May 4, 2023
abhinavdangeti pushed a commit that referenced this pull request May 16, 2023
* address potential empty slice panic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants