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

Panic in Leveldb #6880

Closed
Stebalien opened this issue Feb 6, 2020 · 3 comments
Closed

Panic in Leveldb #6880

Stebalien opened this issue Feb 6, 2020 · 3 comments
Labels
exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) panic status/ready Ready to be worked

Comments

@Stebalien
Copy link
Member

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

goroutine 91 [running]:
github.com/syndtr/goleveldb/leveldb.(*DB).newRawIterator(0xc00028b040, 0x0, 0x0, 0x0, 0x0, 0xc00048e060, 0x0, 0x1, 0xc000044480)
	pkg/mod/github.com/syndtr/goleveldb@v1.0.0/leveldb/db_iter.go:54 +0x2a7
github.com/syndtr/goleveldb/leveldb.(*DB).newIterator(0xc00028b040, 0x0, 0x0, 0x0, 0x0, 0xa7, 0xc00048e000, 0x0, 0xc00048e000)
	pkg/mod/github.com/syndtr/goleveldb@v1.0.0/leveldb/db_iter.go:79 +0x99
github.com/syndtr/goleveldb/leveldb.(*DB).NewIterator(0xc00028b040, 0xc00048e000, 0x0, 0x0, 0x0)
	pkg/mod/github.com/syndtr/goleveldb@v1.0.0/leveldb/db.go:891 +0x189
github.com/ipfs/go-ds-leveldb.(*accessor).Query(0xc000262260, 0xc0000443c0, 0x12, 0x0, 0x0, 0x0, 0xc00014c000, 0x1, 0x1, 0x0, ...)
	pkg/mod/github.com/ipfs/go-ds-leveldb@v0.4.0/datastore.go:120 +0x9d
github.com/ipfs/go-ds-measure.(*measure).Query(0xc0002e2600, 0xc0000443c0, 0x12, 0x0, 0x0, 0x0, 0xc00014c000, 0x1, 0x1, 0x0, ...)
	pkg/mod/github.com/ipfs/go-ds-measure@v0.1.0/measure.go:246 +0x12c
github.com/ipfs/go-datastore/mount.(*Datastore).Query(0xc000262300, 0xc000163260, 0x12, 0x0, 0x0, 0x0, 0xc00014c000, 0x1, 0x1, 0x1, ...)
	pkg/mod/github.com/ipfs/go-datastore@v0.3.1/mount/mount.go:264 +0x3e1
github.com/ipfs/go-ds-measure.(*measure).Query(0xc0002e2900, 0xc000163260, 0x12, 0x0, 0x0, 0x0, 0xc00014c000, 0x1, 0x1, 0x1, ...)
	pkg/mod/github.com/ipfs/go-ds-measure@v0.1.0/measure.go:246 +0x12c
github.com/ipfs/go-datastore/keytransform.(*Datastore).Query(0xc00015b4e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc00014c000, 0x1, 0x1, 0x1, ...)
	pkg/mod/github.com/ipfs/go-datastore@v0.3.1/keytransform/keytransform.go:71 +0x1d5
github.com/ipfs/go-ipfs-provider/queue.(*Queue).getQueueHead(0xc000441090, 0x0, 0x0, 0x0)
	pkg/mod/github.com/ipfs/go-ipfs-provider@v0.3.0/queue/queue.go:137 +0x121
github.com/ipfs/go-ipfs-provider/queue.(*Queue).work.func1(0xc000441090)
	pkg/mod/github.com/ipfs/go-ipfs-provider@v0.3.0/queue/queue.go:83 +0x873
created by github.com/ipfs/go-ipfs-provider/queue.(*Queue).work
	pkg/mod/github.com/ipfs/go-ipfs-provider@v0.3.0/queue/queue.go:73 +0x4f

@Stebalien Stebalien added the kind/bug A bug in existing code (including security flaws) label Feb 6, 2020
@Stebalien
Copy link
Member Author

Hm. Looks like an issue with closing while iterating. I guess we'll need to port the fix from go-ds-badger and take a RWLock when accessing/closing.

@Stebalien
Copy link
Member Author

Also, we should fix how we manage the provider queue such that we wait for it to stop before trying to close the datastore.

@Stebalien Stebalien added the panic label Feb 7, 2020
@Stebalien Stebalien added status/ready Ready to be worked exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue labels Feb 7, 2020
willscott added a commit to ipfs/go-ds-leveldb that referenced this issue Feb 20, 2020
Add a `sync.RWMutex` protecting the Close operation.
Follows the same pattern as in go-ds-badger.
Address #29 / ipfs/kubo#6880
willscott added a commit to ipfs/go-ds-leveldb that referenced this issue Feb 25, 2020
Add a `sync.RWMutex` protecting the Close operation.
Follows the same pattern as in go-ds-badger.
Address #29 / ipfs/kubo#6880
willscott added a commit to ipfs/go-ds-leveldb that referenced this issue Feb 25, 2020
Add a `sync.RWMutex` protecting the Close operation.
Follows the same pattern as in go-ds-badger.
Address #29 / ipfs/kubo#6880
@Stebalien
Copy link
Member Author

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) panic status/ready Ready to be worked
Projects
None yet
Development

No branches or pull requests

1 participant