deltachat / deltachat-core-rust

Delta Chat Rust Core library, used by Android/iOS/desktop apps, bindings and bots 📧
https://delta.chat/en/contribute
Other
663 stars 85 forks source link

Application-updates that exceed download-on-demand limit are not processed after download-action #4543

Closed hpk42 closed 1 year ago

hpk42 commented 1 year ago

With the current "xdcstore" development there are application updates with up to 700KB. When "download-on-demand" is enabled and the limit is superseeded, one can trigger a download in the respective chat but the application update does not seem to arrive afterwards. Core is today's master. image

gerryfrancis commented 1 year ago

Maybe related: https://github.com/deltachat/deltachat-core-rust/issues/2970

r10s commented 1 year ago

while there are several discussions about improving in general (eg. always downloading updates, or only requested updates etc), a minimal fix would be to have the download shown as above, however, once tapped, it gets added as an app update.

question that also needs to be answered is if the update will be added "last" or at its "correct place wrt date", might be, that gets answered when working on a fix and one dives deeper into these things again :)

ftr, we had a similar issue where the app was not downloaded but updates already arrive: https://github.com/deltachat/deltachat-core-rust/pull/3487

link2xt commented 1 year ago

I created a test at #4559, but it succeeds already.

r10s commented 1 year ago

i was wondering if it is a store bug only, therefore, i checked the issue with @webratte's Shared-Memo Webxdc on desktop:

=>i get the "Download Message" button in the chat - however, pressing it, nothing arrives in the webxdc

link2xt commented 1 year ago

I will try to extend the test with receiving some other message before clicking "download".

UPD: still works

link2xt commented 1 year ago

I also tested manually with Desktop by setting "Auto-Download Messages" to "Up to 40 KiB" and testing against xstore@testrun.org - everything works as expected: I click to download Reactle and get a message "[279.02 KiB message] - Download", I click "Download" and the app immediately appears as downloaded in the .xdc. Also works if I close and reopen the xdc in-between.

link2xt commented 1 year ago

I tested both master and stable core, both work.

link2xt commented 1 year ago

I think it is a bug in the Android UI or in the store app.

I have just built the latest master branch core and tried it on Desktop and Android against the store bot. On Desktop everything works, but on Android updates downloaded while the app was closed are not applied correctly.

Here is a screenshot after downloading 2 updates with large .xdcs, opening the store .xdc and downloading another small .xdc that got downloaded immediately: storebot

You can see that console reports downloading 2 webxdcs updates, but the store xdc failed to save them into the IndexedDB. This is why it appears as if they were not processed at all. Third xdc was saved successfully and the "downloading" button turned into a green "share" button.

I copy-pasted the first error received in the console:

{"stack":"Error: Failed to execute 'put' on 'IDBObjectStore': Evaluating the object store's key path did not yield a value.\n    at https://acc1-msg301763.localhost/assets/index-9e6f0575.js:1:48330\n    at new Promise (<anonymous>)\n    at Ni.update (https://acc1-msg301763.localhost/assets/index-9e6f0575.js:1:48207)\n    at async qi (https://acc1-msg301763.localhost/assets/index-9e6f0575.js:1:50764)"}

I opened the issue at the store bot repo: https://github.com/webxdc/store/issues/203

link2xt commented 1 year ago

Closing it here as it is a bug in the store app https://github.com/webxdc/store/issues/203 and I made a fix that works https://github.com/webxdc/store/pull/204 so I am sure it is not a core bug.

@r10s For the shared memo app I opened an issue https://github.com/webratte/Shared-Memo/issues/29

r10s commented 1 year ago

great! really looked like a core issue at first, esp as also the next, unrelated app had a similar behavior :) thanks a lot for figuring that out 👍

webratte commented 1 year ago

I'm not sure. But if this happens on all webxdc with bigger updates, wouldn't it be better to fix it for all future Apps directly in webxdc.js (is this the correct filename?)? Especially after the first update it works.

I'm not really a developer. But also really Developer's stumbled over it with the store App. I think this will happen again and again in future Apps.

Maybe there is no way to fix it in webxdc.js. Of course everyone have to fix it on it's own.

link2xt commented 1 year ago

Yes, there is no way to fix the issue we have in the store on the core level or in webxdc.js, it is just a race condition in the store that it fails to apply update right after starting.

webratte commented 1 year ago

OK. So I have to figure out how I can fix it in my App. Maybe I will come back if I find no way to fix it. I will investigate how you fixed it in the store app. Hopefully I will understand 😁