Forráskód Böngészése

tracing: ensure we hold the lock when writing to the writer (#1135)

Chris Bannister 7 éve
szülő
commit
c569537cf6
1 módosított fájl, 3 hozzáadás és 3 törlés
  1. 3 3
      session.go

+ 3 - 3
session.go

@@ -1646,12 +1646,12 @@ func (t *traceWriter) Trace(traceId []byte) {
 		elapsed   int
 	)
 
-	fmt.Fprintf(t.w, "Tracing session %016x (coordinator: %s, duration: %v):\n",
-		traceId, coordinator, time.Duration(duration)*time.Microsecond)
-
 	t.mu.Lock()
 	defer t.mu.Unlock()
 
+	fmt.Fprintf(t.w, "Tracing session %016x (coordinator: %s, duration: %v):\n",
+		traceId, coordinator, time.Duration(duration)*time.Microsecond)
+
 	iter = t.session.control.query(`SELECT event_id, activity, source, source_elapsed
 			FROM system_traces.events
 			WHERE session_id = ?`, traceId)