andyleap / go-ssb

GNU General Public License v3.0
42 stars 13 forks source link

Address in use ⇒ segmentation violation #6

Open kseistrup opened 7 years ago

kseistrup commented 7 years ago

If sbot is already running, launching a second instance will cause a SIGSEGV:

$ ./sbot
2017/05/16 15:12:29 ; defined templates are: "avatar.tpl", "channel.tpl", "contact.tpl", "post.tpl", "vote-simple.tpl", "vote.tpl", "about.tpl", "git-repo.tpl", "git-update.tpl", "message.tpl"
2017/05/16 15:12:29 ; defined templates are: "blob.tpl", "feed.tpl", "index.tpl", "profile.tpl", "upload.tpl", "admin.tpl", "channel.tpl", "header.tpl", "navbar.tpl", "post.tpl", "search.tpl", "thread.tpl"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x789709]

goroutine 1 [running]:
net/rpc.(*Server).Accept(0xc420019b00, 0x0, 0x0)
    /usr/lib/go/src/net/rpc/server.go:623 +0x29
net/rpc.Accept(0x0, 0x0)
    /usr/lib/go/src/net/rpc/server.go:681 +0x41
main.main()
    /var/local/src/g/go/src/github.com/andyleap/go-ssb/cmd/sbot/main.go:65 +0x181
$ cat -n main.go | sed -n '63,67p'
    63      l, _ := net.Listen("tcp", ":9822")
    64
    65      r.Accept(l)
    66
    67      select {}