Skip to content

Panic on Read() in rtpreceiver.go #2322

@MikolajMGT

Description

@MikolajMGT

Your environment.

  • Version:
    github.com/pion/dtls/v2 v2.0.10
    github.com/pion/ice/v2 v2.1.13
    github.com/pion/randutil v0.1.0
    github.com/pion/rtcp v1.2.8
    github.com/pion/rtp v1.7.4
    github.com/pion/sdp/v3 v3.0.4
    github.com/pion/webrtc/v3 v3.1.6

Hi, I've got following panic error several times last week:

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

goroutine 605202 [running]:
github.com/pion/webrtc/v3.(*RTPReceiver).Read(0xc004320ea0, {0xc0074a4c00, 0x5b4, 0x5b4})
	/Users/mikolaj-praca/go/pkg/mod/github.com/pion/webrtc/[email protected]/rtpreceiver.go:182 +0x90
github.com/pion/webrtc/v3.(*RTPReceiver).ReadRTCP(0xc004320ea0)
	/Users/mikolaj-praca/go/pkg/mod/github.com/pion/webrtc/[email protected]/rtpreceiver.go:207 +0x65
gitlab.com/evemeta/zucasa/backend/sfu/gateway/app/v1/sfu.(*User).onTrack.func3()
	/Users/mikolaj-praca/GolandProjects/zucasa/backend/sfu/gateway/app/v1/sfu/user.go:417 +0x36
created by gitlab.com/evemeta/zucasa/backend/sfu/gateway/app/v1/sfu.(*User).onTrack
	/Users/mikolaj-praca/GolandProjects/zucasa/backend/sfu/gateway/app/v1/sfu/user.go:415 +0x45e

According to stack trace, the issue itself occurs in following method of rtpreceiver.go:

// Read reads incoming RTCP for this RTPReceiver
func (r *RTPReceiver) Read(b []byte) (n int, a interceptor.Attributes, err error) {
	select {
	case <-r.received:
		return r.tracks[0].rtcpInterceptor.Read(b, a) // <--- here
	case <-r.closed:
		return 0, nil, io.ErrClosedPipe
	}
}

Unfortunately I don't know how to reproduce it yet. But at this point I would like to clarify: is the panic expected behavior resulting from my incorrect implementation, or maybe there is some missing error handling / nil check here?

Best Regards
Nicolas

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions