Local storage not working properly

Bug #1487754 reported by RICQ David
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Oxide
Fix Released
Undecided
Unassigned
webbrowser-app (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Hi,

I noticed some days ago now, that local storage (and may be other web storage) not persist data randomly.
It's pretty easy to show the issue with a website which use local storage.

To reproduce this issue :
- With a phone or emulator, go to http://todomvc.com/examples/angularjs/
- Create a simple todo list
- Close the browser
- Open the browser
- And go back to http://todomvc.com/examples/angularjs/
- If data are correctly restored, reproduce all the step and you will see, sometimes, it not restore the last local storage.

So the issue is present in Browser.

I also noticed, it happens in webview, for example in my application : https://uappexplorer.com/app/yaoswa.inglebard
So the problem exist in Webview too.

Revision history for this message
Olivier Tilloy (osomon) wrote :

It looks like a race condition to me. I managed to observe this only once in repeated attempts: the last item I entered in the todo-list didn’t get saved. Since bug #1456267 was fixed (in oxide 1.8), local storage data gets flushed to disk when the app becomes inactive, which happens as soon as opening the apps exposé. It could be that the app was closed fast enough that it didn’t allow the data to actually be written to disk. Not sure what can be done about that. Adding an oxide task to track the issue anyway.

Changed in webbrowser-app (Ubuntu):
status: New → Invalid
Revision history for this message
RICQ David (davidricq87) wrote :

Hi Olivier,

What do you mean by "inactive" ?

In navigator :

After localstorage change, I try to wait less than 5 second before close the app. It happens several times.
After localstorage change, I try to wait 5 second before close the app. It happens 1 time.
After localstorage change, I try to wait 10 second before close the app. It never happens.

So maybe there a race condition like you said.

In webview :

I try to find a workaround for my app.
And now data are only flush only once during the first launch of the app.
Other write never flush to local storage after app exit.
I can wait more than 10 minutes or put it in the background or lock the screen nothing is flush to local storage.

My code cannot be a problem because it works well during runtime (And I read directly in local storage). There are also no issue on desktop browser (chromium,firefox).

Revision history for this message
Olivier Tilloy (osomon) wrote :

Can you share your code (the one that uses a WebView? On which device are you testing this?

Revision history for this message
RICQ David (davidricq87) wrote :

Hi,

The full code is accessible here : https://github.com/Inglebard/YAOSWA/

I am working in master-dev branch. The concerned file where local storage is present is "app.js" in "js" folder inside "www".
Maybe, there are other issue but don't pay attention.

I attach you an armf click package where the issue is present.

I am testing on BQ Aquaris E4.5.

I also noticed the local storage issue seems less present in emulator but i'm not totally sure.

Revision history for this message
RICQ David (davidricq87) wrote :

Hi,

I move the problem storage issue in branch "localstorage-issue".

Until a solution, I will serialize/unserialize the content of local storage in a file at startup/exit and still use local storage at runtime.

Revision history for this message
Olivier Tilloy (osomon) wrote :

@David: can you still reproduce the issue with recent images? I’ve just tested again on an MX4 running the latest rc-proposed image, and local storage always get flushed correctly, no matter how fast I close the app after adding an item to the to-do list.

Revision history for this message
RICQ David (davidricq87) wrote :

Hi @osomon,

I just try with to-do list app and my app with HTML5 storage support( < 1.2.0). All seems fix.

Storage are correctly saved/restored.

Tested on BQ 4.5 (ubuntu-touch/stable/bq-aquaris.en - krillin: #26)

Thanks.

Olivier Tilloy (osomon)
Changed in oxide:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.