Giter VIP home page Giter VIP logo

Comments (6)

chris-horner avatar chris-horner commented on July 16, 2024

addToList() calls through to observeAddToList(), which first calls get(), modifies the list, and then flatMaps to observePut(). observePut() runs inside of a write lock. I may have missed something, but I'm reasonably certain that should protect you from race conditions.

Are you able to create a small sample that reproduces your issue?

from rxstore.

theangrydev avatar theangrydev commented on July 16, 2024

I'll have a go at a minimal example when I get some time, could be that I messed something up in my own code. Thanks for the quick response!

from rxstore.

theangrydev avatar theangrydev commented on July 16, 2024

Ah yeah, think I might have spotted the cause. The get() loads a copy of the list L1 in thread A. It adds the new value A in the map inside observeAddToList. Now thread B does the same thing, loads a copy of the list, also L1 and adds B in the map inside observeAddToList, before thread A has entered the write lock inside observePut. At this point one update is already guaranteed to be lost. I think you need both the read and the write of the list inside the write lock to avoid this issue

from rxstore.

chris-horner avatar chris-horner commented on July 16, 2024

Nice detective work. I'll have a deeper look at this tomorrow morning AU time.

from rxstore.

chris-horner avatar chris-horner commented on July 16, 2024

5.0.3 is up now on jcenter with the fix. Should sync to central shortly! Thanks very much for helping us find this bug, @theangrydev

from rxstore.

theangrydev avatar theangrydev commented on July 16, 2024

No problem, thanks for the quick fix

from rxstore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.