Comments (6)
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.
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.
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.
Nice detective work. I'll have a deeper look at this tomorrow morning AU time.
from rxstore.
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.
No problem, thanks for the quick fix
from rxstore.
Related Issues (20)
- Support for different serializers HOT 4
- Drop the dependency on `Context`? HOT 3
- Disk-based LRU cache HOT 2
- Compared to Nhachicha/SnappyDB? HOT 1
- onCompleted() if nothing found at a specified key. HOT 5
- Building requires an internet connection HOT 2
- Remove Roboelectric dependency? HOT 1
- Release based on recent changes? HOT 3
- Which callback should be invoked If the key is not exist? HOT 5
- get methods can't work with generic types HOT 3
- Check existence ? HOT 3
- Store in a zipfile HOT 3
- Convertors should be more flexible. HOT 3
- Possibility of corruption of store data on app termination HOT 2
- Delete store when not needed. HOT 1
- Android + Kotlin build error: Multiple dex files define Lorg/jetbrains/annotations/NotNull HOT 2
- Create legacy rxjava (1) branch? HOT 4
- Getting IOException HOT 9
- Model is converting into LinkedTreeMap HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rxstore.