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

segmentation violation #15

Closed
showsa opened this issue May 16, 2013 · 5 comments
Closed

segmentation violation #15

showsa opened this issue May 16, 2013 · 5 comments

Comments

@showsa
Copy link

showsa commented May 16, 2013

SIGSEGV: segmentation violation
PC=0x45fc7d6
signal arrived during cgo execution

github.com/jmhodges/levigo._Cfunc_leveldb_iter_seek(0x0, 0xc2000abed0, 0x8)
github.com/jmhodges/levigo/_obj/_cgo_defun.c:231 +0x2f
github.com/jmhodges/levigo.(*Iterator).Seek(0xc2000008e8, 0xc2000abed0, 0x8, 0xe)
github.com/jmhodges/levigo/_obj/batch.cgo1.go:579 +0x42
...


$ go version

go version go1.1 darwin/amd64

code

cache := levigo.NewLRUCache(1 << 24) // 16MB
options := levigo.NewOptions()
//options.SetComparator(cmp)
options.SetCache(cache)
options.SetParanoidChecks(true)
options.SetInfoLog(nil)
options.SetWriteBufferSize(1 << 20) // 1MB
options.SetMaxOpenFiles(1023)
options.SetBlockSize(1 << 15) // 32KB
options.SetCompression(1)     // snappy compression, 0 == no compression
options.SetCreateIfMissing(true)

levelDb, err := levigo.Open("./store", options)
if err != nil {
    panic(err)
}
roptions := levigo.NewReadOptions()
//roptions.SetVerifyChecksums(true)
roptions.SetFillCache(false)
defer roptions.Close()

iter :=levelDb.NewIterator(roptions)
iter.Close()

target := append("t_user", uint8(1))
iter.Seek(target)  // <== segmentation violation
@jmhodges
Copy link
Owner

You're ignoring the error from levigo.Open. I'm closing this ticket. Reopen if you see the problem after you've handled that error.

@showsa
Copy link
Author

showsa commented May 17, 2013

levelDb, err := levigo.Open("./store", options)
if err != nil {
panic(err)
}

and no problem to put key/value pairs.

@jmhodges
Copy link
Owner

You close the iterator before you use it. I'm not sure what you expect to happen.

@jmhodges jmhodges reopened this May 18, 2013
@showsa
Copy link
Author

showsa commented May 19, 2013

missed "defer"

Sorry for that.

@jmhodges
Copy link
Owner

No problem! Happens.

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

No branches or pull requests

2 participants