Skip to content
This repository was archived by the owner on Nov 14, 2021. It is now read-only.
This repository was archived by the owner on Nov 14, 2021. It is now read-only.

CountedSyncMap has a race condition. #4

Closed

Description

@Tillaert

Your environment.

  • Version: c11bee9
  • Browser: n/a
  • Other Information -

What did you do?

has a race conditon.

The sync.Map and the len variable are not controlled by mutex/atomic operation. So they can be modified by different threads independently. During a simultanous add and delete, a non empty room can be destroyed. This seems to be a race condition?

What did you expect?

No race conditions present.

What happened?

Activity

  1. Sean-Der commented on Oct 23, 2020

    @Sean-Der
    Member

    @Tillaert that is an excellent point! You are right, we need to perform transactions. I would change sync.Map to just a normal map. Then just put a mutex on the entire structure.

    If you have interest in this repo I would love to give you write access! I think it would be great if we had a simple signaler for people to use. We could also extend to do other useful things. I just don't have the bandwidth myself :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      ⌂ 换网址