mosuka / blast

Blast is a full text search and indexing server, written in Go, built on top of Bleve.
Apache License 2.0
1.08k stars 76 forks source link

segfault on ubuntu #25

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hello,

I ran a fresh build off the latest master and then a segfault happened when I tried to startup blast.

rbastic@asgard:~/go-src/src/github.com/mosuka/blast$ ./bin/blastd data \
>     --raft-addr=127.0.0.1:10000 \
>     --grpc-addr=127.0.0.1:10001 \
>     --http-addr=127.0.0.1:10002 \
>     --raft-node-id=node1 \
>     --raft-dir=/tmp/blast/node1/raft \
>     --store-dir=/tmp/blast/node1/store \
>     --index-dir=/tmp/blast/node1/index \
>     --index-mapping-file=./etc/index_mapping.json

    ____   __              __ 
   / __ ) / /____ _ _____ / /_
  / __ \ / // __ '// ___// __/  The lightweight distributed
 / /_/ // // /_/ /(__  )/ /_    indexing and search server.
/_.___//_/ \__,_//____/ \__/    version 0.4.0

2019/03/14 02:04:44.592113 github.com/mosuka/blast/node/data/service/service.go:104 [ERR] no analyzer with name or type 'ja' registered
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x9b2706]

goroutine 1 [running]:
github.com/mosuka/blast/index.(*Index).Close(0x0, 0xd71c18, 0xc0001f96c8)
    /home/rbastic/go-src/src/github.com/mosuka/blast/index/index.go:175 +0x26
github.com/mosuka/blast/node/data/service.(*Service).Stop(0xc0000a70e0, 0x1, 0xc0001c1640)
    /home/rbastic/go-src/src/github.com/mosuka/blast/node/data/service/service.go:166 +0x33
main.data(0xc0000b14a0, 0xe56c20, 0xc0003a01c0)
    /home/rbastic/go-src/src/github.com/mosuka/blast/cmd/blastd/data.go:135 +0x1559
github.com/mosuka/blast/vendor/github.com/urfave/cli.HandleAction(0xc011c0, 0xd73868, 0xc0000b14a0, 0xc0000a6f00, 0x0)
    /home/rbastic/go-src/src/github.com/mosuka/blast/vendor/github.com/urfave/cli/app.go:490 +0xc8
github.com/mosuka/blast/vendor/github.com/urfave/cli.Command.Run(0xd3d58b, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0xd47611, 0x11, 0x0, ...)
    /home/rbastic/go-src/src/github.com/mosuka/blast/vendor/github.com/urfave/cli/command.go:210 +0x92f
github.com/mosuka/blast/vendor/github.com/urfave/cli.(*App).Run(0xc0000adba0, 0xc0000aa000, 0xa, 0xa, 0x0, 0x0)
    /home/rbastic/go-src/src/github.com/mosuka/blast/vendor/github.com/urfave/cli/app.go:255 +0x69b
main.main()
    /home/rbastic/go-src/src/github.com/mosuka/blast/cmd/blastd/main.go:51 +0x2b2

Looks like a very exciting project, curious to know if I might be building it wrong somehow (Ubuntu 18.10)

mosuka commented 5 years ago

Hi @rbastic,

Thank you for your report.

It doesn't seem to be a binary that includes analyzers used in index mapping. You should specifiy the build tags or optimize the index mapping. I have release new version of Blast (v0.4.0) today. Please try this out after clone new master branch. Following commands makes a binary that include some analyzers and stemmers.

$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 80 $ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 80 $ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 90 $ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 90

$ go get -u -v github.com/blevesearch/cld2 $ cd ${GOPATH}/src/github.com/blevesearch/cld2 $ git clone https://github.com/CLD2Owners/cld2.git $ cd cld2/internal $ ./compile_libs.sh $ sudo cp *.so /usr/local/lib


- build Blast
```bash
$ make \
    GOOS=linux \
    BUILD_TAGS="kagome icu libstemmer cld2" \
    CGO_ENABLED=1 \
    build
ghost commented 5 years ago

Thank you for fast response time! This solved the issue.

Please note I found another bug, a segfault that occurs when the 8080 port is already bound in this case. I will file a separate issue for this (I am assuming that's what you'd prefer.)

Kind regards, Ryan