Skip to content

Potential race condition in key value index #31

Description

@KyleMaas

Probably ought to wrap this in a mutex. Index can be set, potentially multiple times if done concurrently, before the observable finished updating:

err = idx.db.Set([]byte(addr), raw)
if err != nil {
return fmt.Errorf("error in store:%w", err)
}
idx.l.Lock()
defer idx.l.Unlock()
obv, ok := idx.obvs[addr]
if ok {
err = obv.Set(v)
if err != nil {
return fmt.Errorf("error setting value in observable:%w", err)
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions