Jille / rufs

RUFS - share files with your friends
4 stars 0 forks source link

Panic in contentserver #30

Closed Jille closed 3 years ago

Jille commented 3 years ago
18:20:38.096536 connectivity.go:103: Connected to RuFS. My endpoints: [143.178.163.214:12010]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x9655b1]

goroutine 513 [running]:
sync.(*Mutex).Lock(...)
        /usr/lib/go-1.13/src/sync/mutex.go:74
github.com/sgielen/rufs/client/content.content.ReadFile(0xc0001caff0, 0x10808e0, 0xc000111970, 0x1, 0xc000111970)
        /home/quis/go/src/github.com/sgielen/rufs/client/content/contentserver.go:131 +0x2e1
github.com/sgielen/rufs/proto._ContentService_ReadFile_Handler(0xacb7e0, 0x150ba20, 0x107ecc0, 0xc0000f4240, 0xc0003fc8c0, 0xe)
        /home/quis/go/src/github.com/sgielen/rufs/proto/rufs_grpc.pb.go:529 +0x109
github.com/sgielen/rufs/client/content.streamInterceptor(0xacb7e0, 0x150ba20, 0x107ecc0, 0xc0000f4240, 0xc00033ef00, 0xfb52d0, 0x107ac80, 0xc0002abfb0)
        /home/quis/go/src/github.com/sgielen/rufs/client/content/contentserver.go:93 +0x123
google.golang.org/grpc.(*Server).processStreamingRPC(0xc0000341c0, 0x1082680, 0xc000551500, 0xc0002a6b40, 0xc0001aa390, 0x14e0960, 0x0, 0x0, 0x0)
        /home/quis/go/pkg/mod/google.golang.org/grpc@v1.37.0/server.go:1471 +0x486
google.golang.org/grpc.(*Server).handleStream(0xc0000341c0, 0x1082680, 0xc000551500, 0xc0002a6b40, 0x0)
        /home/quis/go/pkg/mod/google.golang.org/grpc@v1.37.0/server.go:1544 +0xcf0
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc0003fca20, 0xc0000341c0, 0x1082680, 0xc000551500, 0xc0002a6b40)
        /home/quis/go/pkg/mod/google.golang.org/grpc@v1.37.0/server.go:878 +0xbb
created by google.golang.org/grpc.(*Server).serveStreams.func1
        /home/quis/go/pkg/mod/google.golang.org/grpc@v1.37.0/server.go:876 +0x204
  circleState := circles[circle]

  circleState.mtx.Lock()  # line 131

Not sure I can explain that: circleState could be nil if circles[circle] doesn't exist, but then it should've crashed on reading circleState.mtx rather than calling (nil).Lock().

circleState being nil seems very plausible. This client has registered with this circle during its lifetime, so circleState not being initialized is possible. As usual, I suspect 058b215fd967e9964f3e3d05f764d3c1a724adb6.