Skip to content

Race in Pruner #554

Description

@timbray

Pruner's rebuildWhileLocked() calls memState.Iterate() while its MatchesForEvent() calls memState.Contains(). rebuildWhileLocked defends against itself with a mutex, but not against Contains.

Also, a recent PR switched memState from a map to a slice to retain the order, in order to preserve MatcherBuildMode semantics, but Containts now traverses the whole slice; since Contains is called from MatchesForEvent, its performance is now O(N) where N is the number of patterns added.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions