Sfoglia il codice sorgente

Fix data race between event processing and session when concurrent goroutines are potentially accessing schema details or creating, altering keyspaces and tables.

Ghislain 'Aus' Lacroix 8 anni fa
parent
commit
3b79a4f810
1 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  1. 3 0
      events.go

+ 3 - 0
events.go

@@ -106,6 +106,9 @@ func (s *Session) handleEvent(framer *framer) {
 }
 
 func (s *Session) handleSchemaEvent(frames []frame) {
+	s.mu.RLock()
+	defer s.mu.RUnlock()
+
 	if s.schemaDescriber == nil {
 		return
 	}