plateaukao / einkbro

A small, fast web browser based on Android WebView. It's tailored for E-Ink devices but also works great on normal android devices.
Other
1.19k stars 86 forks source link

Save tab does not work well with lazy loading and new tab background. #150

Closed gety9 closed 1 year ago

gety9 commented 2 years ago

Update: it wasn't crash issue, but that save tab feature does not work well with lazy loading and new tab background features.

details here > https://github.com/plateaukao/einkbro/issues/150#issuecomment-1382813514


After new update Eink bro keeps crashing. It can open some tabs fine, but then when i open more (usually 5+) when i hit new tab it crashes. (closes, and when i reopen it loads not all tabs, for example it was 5 tabs, and after reload it loads only 3) Before i could have 10+ tabs with no problems.

v. 9.4.1, using save tabs feature. Boox Note Air 2.

plateaukao commented 2 years ago

Could you provide me with the crash logs?

I tried open 15 tabs, and it works well on my device.

gety9 commented 2 years ago

@plateaukao

could you please explain how to do it? (crash logs)

Also maybe 'crash' is wrong word - eink bro just closes, and when i reopen it some tabs dissapear (save tab feature is not working properly.)

plateaukao commented 2 years ago

If you don't know how to get logs, then it's fine, since it takes several steps (in settings and command line) to be able to get it.

One thing I'm curious though: are the websites you're loading are full of lots of images and texts? If you could provide me a list of urls that would force close EinkBro on your Air 2 device, that would be very helpful.

gety9 commented 2 years ago

@plateaukao

Seems like pretty much any youtube video causes crashes.

Steps: 1, open youtube video or two 2, open several more tabs (any website, even regular text pages)

it will crash

----, It was introduced by one of latests updates, before i could have 15 youtube video tabs and it worked fine.

plateaukao commented 2 years ago

I tried opening 14 tabs with 5 youtube tabs in it on my Poke4S, the low end Onyx device, and it still works. IMG20220806001822

gety9 commented 2 years ago

@plateaukao

Do you have "Save tabs" checked (enabled) ?

plateaukao commented 2 years ago

yes,it's enabled.

gety9 commented 2 years ago

@plateaukao

Strange, keeps crashing for me. It seems to happen when i press "+" (new tab) or "pen" (edit url) icons.

gety9 commented 2 years ago

@plateaukao

Still have problem with this. Please help :)

Do i need to do these steps to get logs? https://help.testlio.com/en/articles/129738-how-to-get-logs-from-your-android-device

plateaukao commented 2 years ago

yes. The steps in the article should work to get logs. If you can follow it and get logs successfully, please send me the link of logs.

plateaukao commented 2 years ago

another way would be giving me a list of exact urls combination that will crash the app in your device. I could try to reproduce locally.

gety9 commented 2 years ago

@plateaukao

Daniel, seems like it's related to usb keyabord (i can crash Eink bro only when usb keyboard is connected - problem i use it all the time :) so it always crashes)

And i can't log crash cause i can't connect device to PC (for logging) and usb keyboard at once - there is only one usb port.

Maybe it's related to this issue https://stackoverflow.com/questions/18444476/android-crashes-on-keyboard-plugging ?

gety9 commented 2 years ago

@plateaukao

Actually no. Just now crashed without keyboard connected...

plateaukao commented 2 years ago

@gety9 you could try apps like https://play.google.com/store/apps/details?id=com.apptiva.logviewer that would collect logs on device.

gety9 commented 2 years ago

@plateaukao

here is the log https://justpaste.it/22ez8

There are 2 crashes (closer to the end of log)

-, 1st is when i hit edit (pen icon) and it simply closed Ein bro (seems like most frequent crash trigger is when typing becomes possible - "+" icon (new tab) or "pen" icon (edit) - basically when input field for url appears)

-, 2nd is when it reopened Eink bro and instead of loading ~20 tabs only 11 tabs were loaded (9 dissapeared) (it's not crash, more bug - basically 9 tabs dissapeared)

plateaukao commented 2 years ago

Hi, @gety9 Thanks for providing the logs. In order to be able to track where the error happens with clear stacktrace, you may need to use debuggable apk instead, while catching the logs. I uploaded one here: https://github.com/plateaukao/einkbro/releases/download/v9.7.0/app-releaseDebuggable.apk

Also, in recent versions, some times the app would crash when there are too many tabs, or under certain tab manipulation. And I tried to fix it in latest commits. Maybe you would like to try the latest version too (which is not released yet): https://nightly.link/plateaukao/einkbro/workflows/buid-app-workflow.yaml/main/app-release.apk.zip

In the log you provided, I can only tell it's related to Android's Compose implementation, but I can't yet tell why it happened: image

gety9 commented 2 years ago

@plateaukao

installed debuggable

here is log https://justpaste.it/88enq

logged 1 crash & 1 bug:

-, 1st on "+" or "pen" icon press (basically when url input was active). Eink bro crashed/closed

-, 2nd when unplugging keyboard all tabs (were close to 9) dissapeared, only 1 tab remained. There were not crash, Eink bro didn't close.

plateaukao commented 2 years ago

It looks like it's something related to Android library itself. For crash 1, does it happen if you don't connect keyboard?

image

As for crash 2, you may need to provide me what 20 urls you're connecting. It may be related to the links; so that I can try to reproduce the issue. (When einkbro can't open saved tabs, it just skips them.)

plateaukao commented 2 years ago

Also, I tried unplug keyboard (with usb cable) on my Nova AirC, it looks all normal.

plateaukao commented 2 years ago

May I know what input method are you using? Could you try to use other input method instead?

gety9 commented 2 years ago

@plateaukao

-, default input method is google board, but when physical keyboard is connected it hides (and physical is used)

Screenshot_2022-09-27_13-15-33

gety9 commented 2 years ago

-, "For crash 1, does it happen if you don't connect keyboard?"

Hardly ever, only happened 1 time so far. (once i started paying attention). I could open 50+ tabs and hit pen or + icons and type on gboard and it works... As soon as i connected physical keyboard i can crash it with 1-3 tabs by hiting + or pen icons.

gety9 commented 2 years ago

-, "As for crash 2, you may need to provide me what 20 urls you're connecting. It may be related to the links; so that I can try to reproduce the issue. (When einkbro can't open saved tabs, it just skips them.)"

it's triggered by connect/disconnect of physical keyboard. I can open 1-3 tabs (any), connect or disconnect kyboard and it will "reset" it to 1 (i don't open or close Eink Bro)

gety9 commented 2 years ago

@plateaukao

Is Eink bro based on chrome? Maybe i should install chrome to see if problem comes from it? (cause on android firefox i don't have issues)

MarjaE2 commented 2 years ago

Lately, it crashes about half the time I close a tab.

plateaukao commented 2 years ago

No, EinkBro is not based on Chrome, which is very fat. EinkBro is created with WebView component. Firefox implements its web engine and every other thing, so usually all the behavior on it is independent on other browsers.

The crash log shows that it happens on Androids new UI library Jetpack Compose, which I adopt since v9.0.0. I don't think other browsers already adopt it too, since it's a new UI framework from Android from last year.

Please try other input method to see if it still crash a lot. I still doubt that it's under certain combination that this issue happens, which is why I still can't reproduce on my side.

Also, try v9.8.0. I fixed some issues related to close tabs. It may help. I hope so.

gety9 commented 2 years ago

@plateaukao @MarjaE2

"Lately, it crashes about half the time I close a tab."

-, yes, also notice (new bug), it freezes (for 3-5 seconds) or sometimes crashes when i am closing tabs (especially if i start from bottom) - i mean in tab view.

It seems to happen when in bottom row only one tab is shown ("one 'brick' to stand on")

Screenshot_2022-09-28_03-28-31

But this bug is minor, it does not bother me as much.

@plateaukao

"The crash log shows that it happens on Androids new UI library Jetpack Compose, which I adopt since v9.0.0."

-, yes, it started with "new" updates.

-, could it be related to one of these:

https://stackoverflow.com/questions/65136940/webview-crashing-on-input-when-used-with-jetpack-compose

https://stackoverflow.com/questions/73509824/compose-text-field-crashing-when-trying-to-input-accents-via-physical-keyboard

?

gety9 commented 2 years ago

@plateaukao

i tried to understand why Jetpack Compose made Eink bro less stable/slow, these posts seem relevant:

https://medium.com/okcredit/comparing-jetpack-compose-performance-with-xml-9462a1282c6b

https://www.reddit.com/r/androiddev/comments/n61qxh/comment/h8b8nct/

https://stackoverflow.com/a/70326048

https://www.reddit.com/r/androiddev/comments/n61qxh/comment/i4wh034/

Sharing with you in hope that it will be helpfull.

plateaukao commented 2 years ago

@gety9 Thanks for providing useful links that may related to the issue. The issue should be more related to Compose version TextField, not the webview, because the input UI is not inside WebView. I will look through these links.

plateaukao commented 2 years ago

@MarjaE2 Please try version 9.8.0. the latest version should have fixed the "close tab crash" issue.

gety9 commented 2 years ago

@plateaukao

"Thanks for providing useful links that may related to the issue."

-, it's thank you for amazing project!

"The issue should be more related to Compose version TextField, not the webview, because the input UI is not inside WebView."

-, last 4 links are related to MarjaE2 issue (tab closing which makes tab 'triangles' rearrange causing freeze / stometimes crash)

-, once you said TextFied i found this: https://stackoverflow.com/questions/72126372/super-composable-function-crashes-at-text-input

it has the video of the bug and is somewhat similar to what we have, solution is in comments.

MarjaE2 commented 2 years ago

Ues, it's much more stable, hasn't crashed so far.

gety9 commented 2 years ago

@plateaukao

"As for crash 2, you may need to provide me what 20 urls you're connecting. It may be related to the links; so that I can try to reproduce the issue. (When einkbro can't open saved tabs, it just skips them.)"

-, i got idea:

We have 2 problems:

--, 1, that Eink bro crashes ((for me) usually happens when physical keyboard is connected, and pen / or + icons are pressed)

--, 2, that Eink bro 'looses' tabs on reopen

1 one is annoying, but acceptable (at least for me - simply reopen Eink bro, takes 1 second), 2 is much much worse

Is it possible to change the behavior of "skipping"? Maybe keep the tab but simply show "We weren't able to open the page"(similar to what is shown when there is no internet connection - url/tab is not lost - it's still in tabs)

"When einkbro can't open saved tabs..."

-, smng is wrong here - cause the tabs which are 'lost' were perfectly opened (i read all the content of the page, and simply didin't close it), basically problem is:

--, either at crash Eink bro somehow looses tab (before i try to reopen Eink bro)

--, or after crash (on reopen) Eink bro thinks that he can't open url (though he can, cause he opened it before)

plateaukao commented 2 years ago

@gety9 About the solution part, we could still discuss which way is better. However, I prefer being able to reproduce the issues first, and try to identify the root cause. In this way, a better solution could be considered instead of just trying to enhance some unknown error handling.

plateaukao commented 2 years ago

When trying to save existing tabs info, it will try to get all the urls from each webview instance. Even though each webview can render the content correctly, it does not mean webview could provide me correct url at the moment. In this case, when url is empty or blank, I'll skip saving it to saved tabs. As for why sometimes the returned url is empty, I am not sure; it may be related to the web content/url you browsed. That's why I ask you to provide a url list that can reproduce the issue you encountered; so that I can do further investigation.

gety9 commented 2 years ago

@plateaukao

"However, I prefer being able to reproduce the issues first, and try to identify the root cause."

-, agree, you are completely right

"Even though each webview can render the content correctly, it does not mean webview could provide me correct url at the moment."

-, now i see, thank you for explanation

"That's why I ask you to provide a url list that can reproduce the issue you encountered; so that I can do further investigation."

-, just now i opened 7 tabs of this url:

https://github.com/plateaukao/einkbro/issues/150#issuecomment-1262168532

(i copied url, then (pressed "+" and pasted above url) x 6 times)

On 7th "+" press it crashed, when i reopened the app all 7 tabs where in place (so far everything is saved)

Then i pressed "+" again, it crashed again, and when i reopened Eink Bro it had only 2 tabs shown.

Suprisingly 1 of the tabs had url cleaned! (https://github.com/plateaukao/einkbro/issues/150, no comment part now)

I have feeling that it

-, maybe conected to part of url after # (js loaded)

-, or (more likely) to Eink bro being slowed down (cause often (not always though) there is the pop up that "Eink bro is not responding (do you want to wait/freeze)")


Please tell me if there is anything else i can do to help you investigate it.

gety9 commented 2 years ago

@plateaukao

Did same test without USB keyboard connected - opened 18 urls - no crash.

Tried opening / reopening Eink Bro - all 18 tabs are in place.

Went to apps > manage > freeze apps and frozen Eink Bro, tried to reopen - all 18 tabs in place.

Went again to apps > manage > freeze apps and unfrozen Eink Bro, opened Eink Bro - only 1 tab is in place (17 lost)

plateaukao commented 2 years ago

@gety9

Went again to apps > manage > freeze apps and unfrozen Eink Bro, opened Eink Bro - only 1 tab is in place (17 lost)

Did you turn on Loading non-active tabs in Settings > Behavior/UI ? Without turning on this feature, although it seems that 18 tabs are in place, these tabs may not really be loaded again yet. tab list UI is at first only showing what's been saved as web title in last open time. And it may take some time to wait until all newly created tabs fully loaded again in the background, so that the tab url is available for "save tab info" again.

-, just now i opened 7 tabs of this url: https://github.com/plateaukao/einkbro/issues/150#issuecomment-1262168532

As for this, I will try to connect physical keyboard and see if it happens. If you have other configurations, or any specific app installed on your device, please let me know too. I haven't seen any "EinkBro is not responding, do you want to wait/freeze" on all my Eink devices (around 10 devices, including normal phones).

plateaukao commented 2 years ago

by the way, did you update to v9.8.0 already? or do you still use v9.4.1?

gety9 commented 2 years ago

@plateaukao

"Did you turn on Loading non-active tabs in Settings > Behavior/UI ? Without turning on this feature, although it seems that 18 tabs are in place, these tabs may not really be loaded again yet."

-, no, it's disabled (to save on mobile bandwidth)

-, so you are saying that if i open 5 links with via "new tab (background)", and close Eink Bro before visiting them that they will be lost on re-open of Eink Bro? (because they were not really loaded)

gety9 commented 2 years ago

Already on v9.8.0 (all above tests done on it)

gety9 commented 2 years ago

"so you are saying that if i open 5 links with via "new tab (background)", and close Eink Bro before visiting them that they will be lost on re-open of Eink Bro? (because they were not really loaded)"

-, seems it is yes :) that's were all the confusion was coming from... It's very counterintuitive. Is it possible to change this behavior? cause now tab is not really tab untill you visited page :)


seems it's related to this issue: https://github.com/plateaukao/einkbro/issues/121 we added lazy loading (which is great!), but this new feature doesn't work well with save tab feature (https://github.com/plateaukao/einkbro/issues/118)

gety9 commented 1 year ago

@plateaukao Daniel hi,

I updated to v9.18.0, looks amazing! You really have UX talent:) I use EinkBro everyday and it's by far most convenient browser out there.

Could you please look into this issue? There are a lots of replies here, to summorize:

Save tab feature does not work well with lazy loading and new tab background features.

Example: -, 1 Open new tab in background (don't visit it) Close browser Reopen browser Tab is lost

-, 2 Have any 3 tabs open (visit them) Close Browser Reopen Browser Close Browser Reopen Browser 2 Tabs are lost

You explained "When trying to save existing tabs info, it will try to get all the urls from each webview instance. Even though each webview can render the content correctly, it does not mean webview could provide me correct url at the moment. In this case, when url is empty or blank, I'll skip saving it to saved tabs."

I guess we somehow need to change behavior that we get url even without visting page.

--

Would be very grateful if you look at it, very frequently cause of accidental closer of browser or sleep cycle of device i can loose urls (which are part of my research work) and to refind them it can take 20-30min, or i even can't find them again.... I wouldn't bother you if it was minor... (I understand you work on the project in your free time and grateful for what you've already created - superb browser) But it's super unconvenient issue :)

plateaukao commented 1 year ago

Iβ€˜lo look into it. :)

jspivey40 commented 1 year ago

Pardon me for jumping in, however I'm having crashes related to tabs as well. Haven't tried my Samsung devices, but two moto devices crash in similar fashion as the OP. it's definitely related to tabs and I think video sites as I always get the crashes when opening page in background from long tap menu. I ended up deleting cache and data to get back running. I'll check some of the options mentioned here previously and report back ASAP. BTW, I love what you're doing, even with a capable device I still wanna load this browser up as it's just simple and efficient, and keeps me focused. Keep up the good work my friend.

Is there a roadmap or something with planned features? I was hoping you would add more in depth ad blocking like you just did! Are you planning to add more support for ublock origin/AdBlock plus filters and resources? I know you work on this in spare time, but I do hope you'll keep adding ublock origin or AdBlock plus filter support. It would be incredible to have on "long tap and hold" menu an option to "mark ad" and after tapping in the context menu it creates and saves the AdBlock filter. Something like "xbrowser" would be exactly what I'm talking about. It is like a toned down light version of ublock origin element picker etc. That's basically what I'd love to see eventually, an element picker. Check out xbrowser to see. Thanks πŸ‘ Last for now, are you open to a video sniffer so we can more easily download videos or sniff the stream url and forward to a download manager like ADM or 1dm download manager? Other than those couple things, I can use it full time. I'm sure others might like the streaming vid sniffer and element picker. I do apologize again for jumping in here and the long winded post, and thanks for this very cool, efficient browser, please don't abandon it anytime soon!, πŸ‘πŸ˜ƒ

gety9 commented 1 year ago

@jspivey40

for roadmap/features (adblock & video sniffer, etc) it's better if we post in https://github.com/plateaukao/einkbro/discussions (this way it will be easier for Daniel to sepate bugs vs idea discussions, and "issues" page will be cleaner)

gety9 commented 1 year ago

@plateaukao

Regarding crashes most of mine (90%) happen on new tab ("+" icon)... Eink bro says it based on FossBrowser, maybe it's related

https://github.com/scoute-dich/browser/issues/587 https://github.com/scoute-dich/browser/issues/506

?

plateaukao commented 1 year ago

Pardon me for jumping in, however I'm having crashes related to tabs as well. Haven't tried my Samsung devices, but two moto devices crash in similar fashion as the OP. it's definitely related to tabs and I think video sites as I always get the crashes when opening page in background from long tap menu. I ended up deleting cache and data to get back running. I'll check some of the options mentioned here previously and report back ASAP. BTW, I love what you're doing, even with a capable device I still wanna load this browser up as it's just simple and efficient, and keeps me focused. Keep up the good work my friend.

If you know what websites that crash often, please give me these urls for verification.

Is there a roadmap or something with planned features? I was hoping you would add more in depth ad blocking like you just did! Are you planning to add more support for ublock origin/AdBlock plus filters and resources? I know you work on this in spare time, but I do hope you'll keep adding ublock origin or AdBlock plus filter support. It would be incredible to have on "long tap and hold" menu an option to "mark ad" and after tapping in the context menu it creates and saves the AdBlock filter. Something like "xbrowser" would be exactly what I'm talking about. It is like a toned down light version of ublock origin element picker etc. That's basically what I'd love to see eventually, an element picker. Check out xbrowser to see. Thanks πŸ‘ Last for now, are you open to a video sniffer so we can more easily download videos or sniff the stream url and forward to a download manager like ADM or 1dm download manager? Other than those couple things, I can use it full time. I'm sure others might like the streaming vid sniffer and element picker. I do apologize again for jumping in here and the long winded post, and thanks for this very cool, efficient browser, please don't abandon it anytime soon!, πŸ‘πŸ˜ƒ

No, there's no roadmap. It depends on what features I need at that moment. As for AdBlock enhancement, I just re-write the mechanism to adopt regularly updates. Sure, this should be enabled by users if they want. As for more advanced ublock origin filter support, now I don't have intention to support it yet since it takes more effort to implement and current blocking mechanism is already good enough for me. As for video/media sniffering, I use them from time to time, but I will use other more advanced browser instead.

EinkBro App fits some specific needs and it tries to achieve those aspects better than other browsers; as for more advanced generic features, it's always more convenient to just use other browsers. EinkBro is not intended to be the only browser that users use. :)

plateaukao commented 1 year ago

@gety9 I tried to fix issue related to the lazy loading with save tabs feature. Please download snapshot zip file and extract it, and try to install the version. https://nightly.link/plateaukao/einkbro/workflows/buid-app-workflow.yaml/main/app-release.apk.zip

plateaukao commented 1 year ago

@plateaukao

Regarding crashes most of mine (90%) happen on new tab ("+" icon)... Eink bro says it based on FossBrowser, maybe it's related

scoute-dich/browser#587 scoute-dich/browser#506

?

These two issues of FOSS Browser are more than one and half years ago. All the codes in EinkBro are different from its ancestor already. So, the root cause should be different. Nevertheless, I still looked into these two issues. The developer did not mention what he has changed, or what root cause he found either.