Skip to content

Commit

Permalink
Merge pull request #7332 from TheThingsNetwork/1163-support-gs-mutate…
Browse files Browse the repository at this point in the history
…d-event-data

gs: Fix mutated event data causing panics (evtGatewayConnectionStats)
  • Loading branch information
vlasebian authored Oct 11, 2024
2 parents 569c2cc + a2cf594 commit bb6b88b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/gatewayserver/gatewayserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,9 @@ func (gs *GatewayServer) updateConnStats(ctx context.Context, conn connectionEnt
lastUpdate = time.Now()

stats, paths := conn.Stats()
registerGatewayConnectionStats(decoupledCtx, ids, stats)
// The stats must be cloned, they are passed to the event publisher and must not be modified
// by another goroutine during proto marshalling, otherwise it will trigger a panic.
registerGatewayConnectionStats(decoupledCtx, ids, ttnpb.Clone(stats))
if gs.statsRegistry == nil {
continue
}
Expand Down

0 comments on commit bb6b88b

Please sign in to comment.