blugelabs / bluge

indexing library for Go
Apache License 2.0
1.9k stars 124 forks source link

In memory directory causes nil pointer dereference #44

Closed voldyman closed 3 years ago

voldyman commented 3 years ago

The in memory directory implementation causes nil pointer deference because the Load method returns a nil closer..

stacktrace:

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

goroutine 12 [running]:
github.com/blugelabs/bluge/index.(*closeOnLastRefCounter).DecRef(0xc0002e3ec0, 0x109145a, 0x8000000000000000)
    /Users/voldyman/go/pkg/mod/github.com/blugelabs/bluge@v0.1.3/index/segment_plugin.go:113 +0xae
github.com/blugelabs/bluge/index.(*Snapshot).decRef(0xc00049e200, 0x3, 0x1bd995)
    /Users/voldyman/go/pkg/mod/github.com/blugelabs/bluge@v0.1.3/index/snapshot.go:77 +0xb3
github.com/blugelabs/bluge/index.(*Snapshot).Close(...)
    /Users/voldyman/go/pkg/mod/github.com/blugelabs/bluge@v0.1.3/index/snapshot.go:89
github.com/blugelabs/bluge/index.(*Writer).mergerLoop(0xc00003cd80, 0xc0002ec9c0, 0xc0000503c0)
    /Users/voldyman/go/pkg/mod/github.com/blugelabs/bluge@v0.1.3/index/merge.go:75 +0x4c5
created by github.com/blugelabs/bluge/index.OpenWriter
    /Users/voldyman/go/pkg/mod/github.com/blugelabs/bluge@v0.1.3/index/writer.go:131 +0x8cd
exit status 2
mschoch commented 3 years ago

Sorry, this was already fixed here, I just need to make another release.

https://github.com/blugelabs/bluge/pull/34

voldyman commented 3 years ago

aah, i am using an older version of bluge because of go modules then?

mschoch commented 3 years ago

Right, until I make the release, you would have to checkout master branch somewhere, and use

go mod edit -replace github.com/blugelabs/bluge=/path/to/bluge

voldyman commented 3 years ago

gotcha, thanks!