Skip to content

augmented assignment operators should lock the left hand side #3928

@mahrud

Description

@mahrud

Currently H.cache.blah ??= foo works as follows:

  1. lock H.cache
  2. attempt to read H.cache.blah
  3. unlock H.cache
  4. if successful, return value read in step 2
  5. if it failed:
  6. evaluate foo
  7. lock H.cache
  8. write H.cache.blah = foo
  9. unlock H.cache

Problem: if H.cache is updated between steps 3 and 7, then the value is corrupted. This is also the case for any other augmented assignment operator, e.g. +=. Probably the solution is to lock the left hand side (which isn't always a hash table), but given the code it's unclear how to do this.

I mentioned this here, but it's becoming very critical, so wanted to make it its own issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions