Giter Club home page Giter Club logo

aergo-lib's People

Contributors

chris2nd avatar hayarobi avatar kjunu avatar sg31park avatar sunpuyo avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

aergo-lib's Issues

BadgerDB logger seems to be broken in latest update

Hi, It seems like the latest update of Aergo-lib doesn't allow for BadgerDB instance to be created. Specifically, I can't create a BadgerDB instance without the lib panicing. This didn't happen in the previous version (v1.3.0).

I have a minimal code example to demonstrate this panic:

package main

import (
	"log"

	"github.com/aergoio/aergo-lib/db"
)

func main() {
	aergoDB, err := db.NewBadgerDB("data")
	if err != nil {
		log.Fatal(err)
	}
	defer aergoDB.Close()
}

Here is the panic that is generated:

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

goroutine 1 [running]:
github.com/aergoio/aergo-lib/db.(*extendedLog).Infof(0x0, 0x16b2307, 0x1b, 0xc0054c4080, 0x2, 0x2)
	/Users/nmarley/go/pkg/mod/github.com/aergoio/[email protected]/db/logger.go:24 +0x22
github.com/dgraph-io/badger.(*Options).Infof(...)
	/Users/nmarley/go/pkg/mod/github.com/dgraph-io/[email protected]/logger.go:46
github.com/dgraph-io/badger.newLevelsController(0xc00016c000, 0xc00010fa98, 0x0, 0x0, 0x0)
	/Users/nmarley/go/pkg/mod/github.com/dgraph-io/[email protected]/levels.go:175 +0xe56
github.com/dgraph-io/badger.Open(0x16a3d70, 0x4, 0x16a3d70, 0x4, 0x1, 0x0, 0x0, 0x1, 0x0, 0x17886e0, ...)
	/Users/nmarley/go/pkg/mod/github.com/dgraph-io/[email protected]/db.go:288 +0xb75
github.com/aergoio/aergo-lib/db.NewBadgerDB(0x16a3d70, 0x4, 0x16a755c, 0x8, 0xc00012ca58, 0xc000123f20)
	/Users/nmarley/go/pkg/mod/github.com/aergoio/[email protected]/db/badgerdb.go:96 +0x136
main.main()
	/Users/nmarley/projects/aergo-db-log-broken/main.go:10 +0x48
exit status 2

If it helps, the contents of the data dir after this panic is just a single file MANIFEST.

I believe this is probably related to the replacement of the badger default logger in edf758f, but I am currently not too familiar with the lib. Am I using this wrong (e.g. API changed), or does this look like a legitimate bug?

Thanks,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.