-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ItemsMap doesn't match real object #1187
Comments
There's no By the way, there's an open issue for adding metadata to the local listings! Otherwise you can only get metadata when caching is turned off. See the orange warning box in the function documentation of |
Oh, I think I understand the confusion. A listing is never supposed to give you the actual objects. That's what you would do with |
sorry, i didn't remember the correct api name. when i say list(). I actually mean |
as the pic shows above. boad's itemsmap has 3 key. but db only has 1 object |
I'm sorry, but the screenshot doesn't show the output of Also, if it's not possible to reproduce for yourself, then it's going to be even more difficult for other people to reproduce. Did this happen more than once at least? |
I will save a snapshot when it happens next time. |
Hey guys, I guess i have kind of the same problem: As I just started using rs.js, I don't exactly know what I can do to investigate, but I'd be happy to help in any way possible. calling this results in 20 items being returned // rs is the instance of remotestorage attached to the window
rs.scope('/gb-printer-web/')
.getAll('images/')
.then((images) => {
console.log(Object.values(images).length)
}); I do not know what causes the "false" elements. But when using the "inspektor" app, I can see all 25 items, as well as when I check the 'common' prop besides the 'local' one. A few observations that might help:
|
So... while fiddlling a little more something strage happened... 🤔 First I tried adding another image (item), which worked (so from now on I have 21 working and 26 total items) Then I edited one of the working items in a different Browser, and after the "faulty" browser synced, all items were there and a call to After just waiting a few seconds (probably until the next sync) on the "faulty" browser, the items disappeared again and a call to Then I edited one of the faulty items in a different Browser, and after the "faulty" browser synced, all items were back again and a call to After just waiting another few seconds on the "faulty" browser, the items except for the previously faulty one disappeared again and a call to My installed versions btw are (from package.json):
|
Thanks! This detailed description should be very helpful for debugging the issue. Looks to me like there's some kind of race condition bug in the outgoing sync. I'm currently hoping to get reviews on the TypeScript port of the library, so we can finally start properly refactoring the Sync class (and the changes in that branch may already fix some subtle bugs like this): #1175 |
I built a small app to reproduce the bug: It seems the bug happens when creating "images" (that's what my app is handling) and it's syncing data to remote. |
That would explain why it's been undetected so far. Not many apps both cache and sync binary files. Another good hint for debugging! |
I repro this problem again.
|
This is becoming weirdly common (see latest linked issue, too). I was not aware of this bug happening on any meaningful scale until this issue was opened. Interestingly, all of you also took their screenshots in Chrome. So I'm starting to wonder if something broke with IndexedDB (or how we use it) in Chrome, or if this is reproducible in other browsers and with other caching back-ends. Just from all of what I've read so far, my wild guess would be something in the direction of a function not waiting for a fulfilled promise somewhere. This could also be related to the fairly recent addition of using |
Just a sidenote, as in #1188 actual binary files were mentioned: My App does not store actual binary data (even if it's called |
Mine was in Safari. |
I seem to have reproduced this three times today with my flashcards app like this:
After the sync I was able to access the new objects in Safari but not my iPhone standalone PWA. In that private window, pre-existing data was synchronized but failed to appear because the highest-level folders were 'false': |
Does the same happen in a non-private window? That would be immensely helpful to know. Private modes are notorious for breaking all kinds of local storage in surprising new ways. |
Just tried it in non-private Chrome window and the same thing happens: there were two parent objects in anonymous mode, and after connecting there are four (according to |
I don't know how the syncing works but I imagined a hypothesis that the more objects there are to sync, the more likely it is that some child will arrive before the parent thus making the parent |
Just wanted to add this info in case it helps anyone with debugging. I am sometimes able to re-fetch all data by calling the undocumented |
I seem to have reached a state where a client receives sync events and upon reloading the app, the new documents are not accessible. Perhaps it's happening more often now because there are many more documents. Are there are things that I can test now that this is less random? |
What does "not accessible" mean? Do you see the respective IndexedDB nodes before reloading? |
I managed to capture it on video: https://www.dropbox.com/s/3rj4z2vgdq5t29b/2021.04.08%201%20disappearing.mp4?dl=0 Items created on one client sync to another but disappear on reload. I have observed this in at least three of my apps, and I suspect it might occur when there is a large quantity of documents—if you start fresh with a low document count it might not occur as much. It might also occur because I use Safari on macOS and iOS, and as we know Safari has problems. It seems like the IndexedDB entries are the same on both clients: ChromeSafari |
Okay so another observation is that if I create a new document on the second client and reload, it begins to display the documents that were previously not accessible. This might have to do with my folder structure: each day has a folder, notes created on a given day that sync to another client will disappear if that client has no other notes on that day, but if you create a new note on the receiving client they will appear again. https://www.dropbox.com/s/phojiag6w3ax020/2021.04.08%201%20reappearing.mp4?dl=0 |
Noel De Martin encountered this recently with Chrome on Android rosano/hyperdraft#4 @raucao I'm wondering how you haven't seen this in the wild yet. Are you using 5apps or a different provider? or using mostly anonymous mode? |
I guess the same way that nobody opened an issue before June 2020? It's difficult to explain why when there's no way for me to reproduce it. I'm using 5apps, usually connected to one of my various accounts, both personal ones and organizational. |
I have created a new tracking issue for the sync refactoring, as well as a project to collect sync-related issues and missing features: |
Multiple reads after tasks have been fetched causes folder index to be misaligned. This fix forces fetched tasks to be queued, ensuring that task handlers finish committing their changes before running the next task handler.
Updated inmemorystorage.ts getNodes to follow behavior of localStorage and indexeddb.
The fix for this has just been released with version |
My impression from upgrading all my apps in the last months is that:
Not sure if there's any value to sharing this considering this is very tricky to reproduce, but just thought to share my observations. I would be curious to know if there was a way to somehow guarantee that this could not happen, like what the library test would be. Will try to experiment with syncing larger amounts of data (like with my flashcards app) and report back if I can replicate. |
board's items map doesn't match my real object in DB. In this case, when I call boards.list(). It will return a single true that caused some bug in my app.
I don't have a certain repro step. but it happens when sync be triggered.
Can remotestoragejs just add a single cleanup when this kind of case detected
The text was updated successfully, but these errors were encountered: