Skip to content

router: data race on saveDestinationResponse - plain bool written by config subscriber goroutine, read by workers without lock #7259

Description

@harsh4vardhan

What's happening

rt.saveDestinationResponse is a plain bool written by the backend-config subscriber goroutine and read by worker goroutines on every delivery decision. There's no lock or atomic operation on either side - it's a data race.

Where

router/handle.go, line 76:

saveDestinationResponse bool  // plain bool

router/handle_lifecycle.go, line 491 - written in the subscriber goroutine:

rt.saveDestinationResponse = value  // no lock

router/worker.go, line 863 - read in every worker:

if !w.rt.saveDestinationResponse {  // no lock

The field right next to it, supportsDeliveredWithWarnings, was already fixed with a comment at handle.go lines 86-88:

"Written by the backend-config subscriber and read by workers, hence atomic."

saveDestinationResponse has the exact same access pattern and was missed.

Impact

On ARM or with -race on amd64, a worker can read a stale value and silently suppress or incorrectly store destination response bodies, even after an admin changes the setting. go test -race ./router/... will catch this.

Fix

Same pattern as the adjacent field:

// handle.go
saveDestinationResponse atomic.Bool

// handle_lifecycle.go
rt.saveDestinationResponse.Store(value)

// worker.go
if !w.rt.saveDestinationResponse.Load() {

Environment

rudder-server main branch (2026-08-13), Go.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions