Changing some log levels (#2094)

Logging expected WS close at Infow to understand reasons for closure.
Moving "read from ws" to Debugw as it happens when signalling closes.

Also filter out a data channel abort chunk log as it shows a bunch of
errors, but those are expected though.
This commit is contained in:
Raja Subramanian
2023-09-20 14:13:48 +05:30
committed by GitHub
parent a624e30b74
commit 281d2b674b
4 changed files with 15 additions and 18 deletions
+6 -8
View File
@@ -561,10 +561,9 @@ func (p *ParticipantImpl) HandleSignalSourceClose() {
p.TransportManager.SetSignalSourceValid(false) p.TransportManager.SetSignalSourceValid(false)
if !p.TransportManager.HasPublisherEverConnected() && !p.TransportManager.HasSubscriberEverConnected() { if !p.TransportManager.HasPublisherEverConnected() && !p.TransportManager.HasSubscriberEverConnected() {
p.params.Logger.Infow("closing disconnected participant", reason := types.ParticipantCloseReasonJoinFailed
"reason", types.ParticipantCloseReasonJoinFailed, p.params.Logger.Infow("closing disconnected participant", "reason", reason)
) _ = p.Close(false, reason, false)
_ = p.Close(false, types.ParticipantCloseReasonJoinFailed, false)
} }
} }
@@ -1404,10 +1403,9 @@ func (p *ParticipantImpl) setupDisconnectTimer() {
if p.IsClosed() || p.IsDisconnected() { if p.IsClosed() || p.IsDisconnected() {
return return
} }
p.params.Logger.Infow("closing disconnected participant", reason := types.ParticipantCloseReasonPeerConnectionDisconnected
"reason", types.ParticipantCloseReasonPeerConnectionDisconnected, p.params.Logger.Infow("closing disconnected participant", "reason", reason)
) _ = p.Close(true, reason, false)
_ = p.Close(true, types.ParticipantCloseReasonPeerConnectionDisconnected, false)
}) })
p.lock.Unlock() p.lock.Unlock()
} }
-1
View File
@@ -426,7 +426,6 @@ func (r *Room) ReplaceParticipantRequestSource(identity livekit.ParticipantIdent
rs.Close() rs.Close()
} }
r.participantRequestSources[identity] = reqSource r.participantRequestSources[identity] = reqSource
r.lock.Unlock() r.lock.Unlock()
} }
+1 -1
View File
@@ -832,7 +832,7 @@ func (t *PCTransport) CreateDataChannel(label string, dci *webrtc.DataChannelIni
} }
dcErrorHandler := func(err error) { dcErrorHandler := func(err error) {
if !errors.Is(err, sctp.ErrResetPacketInStateNotExist) { if !errors.Is(err, sctp.ErrResetPacketInStateNotExist) && !errors.Is(err, sctp.ErrChunk) {
t.params.Logger.Errorw(dc.Label()+" data channel error", err) t.params.Logger.Errorw(dc.Label()+" data channel error", err)
} }
} }
+8 -8
View File
@@ -257,7 +257,7 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
) )
done := make(chan struct{}) done := make(chan struct{})
// function exits when websocket terminates, it'll close the event reading off of response sink as well // function exits when websocket terminates, it'll close the event reading off of request sink and response source as well
defer func() { defer func() {
pLogger.Infow("finishing WS connection", "connID", cr.ConnectionID) pLogger.Infow("finishing WS connection", "connID", cr.ConnectionID)
cr.ResponseSource.Close() cr.ResponseSource.Close()
@@ -288,13 +288,13 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// websocket established // websocket established
sigConn := NewWSSignalConnection(conn) sigConn := NewWSSignalConnection(conn)
if count, err := sigConn.WriteResponse(initialResponse); err != nil { count, err := sigConn.WriteResponse(initialResponse)
if err != nil {
pLogger.Warnw("could not write initial response", err) pLogger.Warnw("could not write initial response", err)
return return
} else { }
if signalStats != nil { if signalStats != nil {
signalStats.AddBytes(uint64(count), true) signalStats.AddBytes(uint64(count), true)
}
} }
pLogger.Infow("new client WS connected", pLogger.Infow("new client WS connected",
"connID", cr.ConnectionID, "connID", cr.ConnectionID,
@@ -321,7 +321,7 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return return
case msg := <-cr.ResponseSource.ReadChan(): case msg := <-cr.ResponseSource.ReadChan():
if msg == nil { if msg == nil {
pLogger.Infow("nothing to read from response source", "connID", cr.ConnectionID) pLogger.Debugw("nothing to read from response source", "connID", cr.ConnectionID)
return return
} }
res, ok := msg.(*livekit.SignalResponse) res, ok := msg.(*livekit.SignalResponse)
@@ -372,7 +372,7 @@ func (s *RTCService) ServeHTTP(w http.ResponseWriter, r *http.Request) {
websocket.CloseNormalClosure, websocket.CloseNormalClosure,
websocket.CloseNoStatusReceived, websocket.CloseNoStatusReceived,
) { ) {
pLogger.Debugw("exit ws read loop for closed connection", "connID", cr.ConnectionID, "wsError", err) pLogger.Infow("exit ws read loop for closed connection", "connID", cr.ConnectionID, "wsError", err)
} else { } else {
pLogger.Errorw("error reading from websocket", err, "connID", cr.ConnectionID) pLogger.Errorw("error reading from websocket", err, "connID", cr.ConnectionID)
} }