agl / pond

Pond
BSD 3-Clause "New" or "Revised" License
911 stars 109 forks source link

Pond CLI crashed when deleting message #131

Closed ageis closed 9 years ago

ageis commented 9 years ago
inbox/fau> delete
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x8 pc=0x41474b]

goroutine 1 [running]:
main.(*cliClient).processCommand(0xf8400d1000, 0x5d7350, 0x0, 0x0, 0x7fd776d59100, ...)
        /root/go/src/github.com/agl/pond/client/cli.go:1290 +0x5cf1
----- stack segment boundary -----
main.(*cliClient).mainUI(0xf8400d1000, 0xf84415d000)
        /root/go/src/github.com/agl/pond/client/cli.go:627 +0x2f8
main.(*client).loadUI(0xf8400d1000, 0x7fd776d59d28, 0x100000001, 0xf8400822a0)
        /root/go/src/github.com/agl/pond/client/client.go:847 +0xe4c
main.(*cliClient).Start(0xf8400d1000, 0x12)
        /root/go/src/github.com/agl/pond/client/cli.go:140 +0x42b
main.main()
        /root/go/src/github.com/agl/pond/client/main_linux.go:70 +0x7f6

goroutine 2 [syscall]:
created by runtime.main
        /home/kevin/DPKG/golang/src/pkg/runtime/proc.c:221

goroutine 3 [syscall]:
os/signal.loop()
        /usr/lib/go/src/pkg/os/signal/signal_unix.go:20 +0x1c
created by os/signal.init·1
        /usr/lib/go/src/pkg/os/signal/signal_unix.go:26 +0x2f

goroutine 4 [runnable]:
main.(*terminalWrapper).run(0xf8400ce0b0, 0xf840081930, 0xf84009b000, 0xf8400d2190, 0x0, ...)
        /root/go/src/github.com/agl/pond/client/cli.go:268 +0x202
created by main.NewTerminalWrapper
        /root/go/src/github.com/agl/pond/client/cli.go:188 +0x18f

goroutine 5 [chan receive]:
main._func_010(0xf84009b258, 0xf84009b240, 0x0, 0x0)
        /root/go/src/github.com/agl/pond/client/cli.go:134 +0x3b
created by main.(*cliClient).Start
        /root/go/src/github.com/agl/pond/client/cli.go:137 +0x38e

goroutine 6 [syscall]:
syscall.Syscall6()
        /home/kevin/DPKG/golang/src/pkg/syscall/asm_linux_amd64.s:40 +0x5
syscall.EpollWait(0xf800000006, 0xf8400ce170, 0xa0000000a, 0xffffffff, 0xc, ...)
        /usr/lib/go/src/pkg/syscall/zerrors_linux_amd64.go:1781 +0xa1
net.(*pollster).WaitFD(0xf8400ce160, 0xf8400c4b00, 0x0, 0xffffffff, 0x0, ...)
        /usr/lib/go/src/pkg/net/fd_linux.go:146 +0x110
net.(*pollServer).Run(0xf8400c4b00, 0x0)
        /usr/lib/go/src/pkg/net/fd.go:236 +0xe4
created by net.newPollServer
        /usr/lib/go/src/pkg/net/newpollserver.go:35 +0x382

goroutine 7 [chan receive]:
github.com/agl/pond/client/disk.(*StateFile).StartWriter(0xf8400d30d0, 0xf84710f870, 0xf84710f8c0, 0x0, 0x0, ...)
        /root/go/src/github.com/agl/pond/client/disk/disk.go:268 +0x3c
created by main.(*client).loadUI
        /root/go/src/github.com/agl/pond/client/client.go:831 +0xc71

goroutine 8 [select]:
main.(*client).transact(0xf8400d1000, 0x0)
        /root/go/src/github.com/agl/pond/client/network.go:878 +0x1093
created by main.(*client).loadUI
        /root/go/src/github.com/agl/pond/client/client.go:832 +0xc8e

goroutine 9 [select]:
github.com/agl/pond/panda.(*HTTPMeetingPlace).Exchange(0xf847110560, 0xf84710faf0, 0xf847126090, 0x2000000020, 0xf84711e000, ...)
        /root/go/src/github.com/agl/pond/panda/appengine.go:128 +0x2d4
github.com/agl/pond/panda.(*KeyExchange).exchange1(0xf847126000, 0xf84710fb20, 0x7fd776c3eea8, 0x20)
        /root/go/src/github.com/agl/pond/panda/panda.go:383 +0xba
github.com/agl/pond/panda.(*KeyExchange).Run(0xf847126000, 0x4354b1, 0xf84009bac8, 0xf84009bab8)
        /root/go/src/github.com/agl/pond/panda/panda.go:291 +0x123
main.(*client).runPANDA(0xf8400d1000, 0xf84415d000, 0x84ca000084ca, 0xfea64d1193522d9c, 0xf84009b6a8, ...)
        /root/go/src/github.com/agl/pond/client/client.go:1231 +0x2c2
created by main.(*client).loadUI
        /root/go/src/github.com/agl/pond/client/client.go:844 +0xe06

goroutine 10 [chan receive]:
main.(*cliInput).processInput(0xf847110c20, 0xf84712d050, 0x0, 0x0)
        /root/go/src/github.com/agl/pond/client/cli-input.go:363 +0x18b
created by main.(*cliClient).mainUI
        /root/go/src/github.com/agl/pond/client/cli.go:606 +0x1e8

goroutine 11 [syscall]:
created by addtimer
        /home/kevin/DPKG/golang/src/pkg/runtime/ztime_amd64.c:72

goroutine 12 [finalizer wait]:
created by runtime.gc
        /home/kevin/DPKG/golang/src/pkg/runtime/mgc0.c:882
burdges commented 9 years ago

I cannot replicate this myself. It appears that c.contacts[obj.from].name is the only data referenced by client/cli.go:1290.

Is there anything weird about the contact you're deleting a message from? Does the show command display the contact's name correctly?

Is this message perhaps from a contact you deleted? I could imagine race conditions through which a message could survive its contact being deleted, like maybe this c.queueMutex.Lock() command should appear earlier before the inbox gets cleaned.

Also I noticed that client/cli.go:1288 is almost identical. So, assuming you haven't deleted this contact, do you get the same error if you send that contact a message but delete the message before the next transaction occurs?

arlolra commented 9 years ago

Should be fixed by #130, no?

ageis commented 9 years ago

I have the latest code. It's still happening.

My environment is Ubuntu 14.04.1 LTS (trusty) 64-bit. All my dependencies are from the regular packages/repositories.

burdges commented 9 years ago

It's the Home Server message you're trying to delete though, right? Or another message?

ageis commented 9 years ago

yes, that's correct. the home server message

agl commented 9 years ago

Thanks!

ageis commented 9 years ago

Thank you for fixing! Updating was weird because I had to wipe out my whole GOPATH. I don't seem to have the pond-build command.