Skip to content

Commit

Permalink
tracing: ensure we hold the lock when writing to the writer (apache#1135
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Zariel authored Jun 2, 2018
1 parent cb53b83 commit c569537
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c569537

Please sign in to comment.