diff --git a/inmem.go b/inmem.go index e8206da..71deef1 100644 --- a/inmem.go +++ b/inmem.go @@ -245,6 +245,8 @@ func (i *InmemSink) Data() []*IntervalMetrics { copyCurrent := intervals[n-1] current.RLock() *copyCurrent = *current + // RWMutex is not safe to copy, so create a new instance on the copy + copyCurrent.RWMutex = sync.RWMutex{} copyCurrent.Gauges = make(map[string]GaugeValue, len(current.Gauges)) for k, v := range current.Gauges {