AdguardBrowserExtension icon indicating copy to clipboard operation
AdguardBrowserExtension copied to clipboard

When AdGuard crashes, it resets settings, leaving you with all filters disabled

Open erkinalp opened this issue 2 years ago • 31 comments

AdGuard Extension version

4.2.209

Browser version

Firefox 120 beta

OS version

Ubuntu 22.04.3

What filters do you have enabled?

irrelevant for the issue, as this is a settings storage issue

What Stealth Mode options do you have enabled?

irrelevant for the issue, as this is a settings storage issue

Issue Details

AdGuard loses settings and filter selections when AdGuard extension process crashes or is forcibly killed. I have filters and then suddenly find myself with all filters disabled.

Expected Behavior

Settings survive crashes

Screenshots

No response

Additional Information

Occasionally, whole Firefox can crash due to AdGuard

erkinalp avatar Nov 15 '23 20:11 erkinalp

@Birbber should be P1 or P2, as this basically makes it unusable

erkinalp avatar Nov 15 '23 20:11 erkinalp

Hello @erkinalp,

Thank you for your report. It is expected behavior that if the settings of the AdGuard extension are corrupted during a browser crash, they will be restored to their default state. This is a safeguard to prevent further issues arising from corrupted settings.

If you are able to provide logs from the background page of the extension after a crash, it might help us understand more about what is happening. Your cooperation in this matter is greatly appreciated and can assist in improving the extension's reliability.

maximtop avatar Nov 16 '23 09:11 maximtop

It is expected behavior that if the settings of the AdGuard extension are corrupted during a browser crash, they will be restored to their default state.

No other extension does that, and the default state makes it with no filters enabled, rather than all default filters enabled, which immediately amplifies CPU time and network traffic due to ads loading. Instead, if the extension is crashed, settings should be validated and valid values used as-is, and only invalid values restored to defaults. This may however require using a hand-rolled fault-tolerant parser, rather than the web browser's standard library parsers.

erkinalp avatar Nov 16 '23 09:11 erkinalp

If you are able to provide logs from the background page of the extension after a crash, it might help us understand more about what is happening. Your cooperation in this matter is greatly appreciated and can assist in improving the extension's reliability.

Will try in the next crash.

erkinalp avatar Nov 16 '23 09:11 erkinalp

I opened the log window and hit "store the log", how to export the log file?

erkinalp avatar Nov 16 '23 09:11 erkinalp

Here you can find instructions https://maximtop.notion.site/How-to-export-logs-from-the-background-page-in-the-extension-fb7e2fe23cb0451ea010672ce0570929?pvs=4

maximtop avatar Nov 16 '23 09:11 maximtop

log file

erkinalp avatar Nov 16 '23 10:11 erkinalp

thanks, Unfortunately, it didn't become clear from the logs. Do you have the steps to reproduce the crash?

maximtop avatar Nov 16 '23 13:11 maximtop

Oh, just enable filters and open lots of tabs, using the browser for a very long time, do not close the browser except for upgrading (even then, kill the main process of the browser instead of properly closing it) and continue browsing session across upgrades (of both your browser and AdGuard, from the session you just killed before installing the upgrade).

erkinalp avatar Nov 16 '23 15:11 erkinalp

And it happens only when AdGuard is enabled?

maximtop avatar Nov 16 '23 15:11 maximtop

Other extensions do not reset settings on crash such aggressively, hence they can be restored to normal operation by reloading the affected tabs. AdGuard requires additional intervention. Hence the suggestion to use a fault-tolerant settings parser.

erkinalp avatar Nov 16 '23 15:11 erkinalp

I'm asking to understand if it crashes the AdGuard extension or the Firefox browser. If the browser, then does it crash without the AdGuard extension?

maximtop avatar Nov 16 '23 16:11 maximtop

If any of tabs crash, it eventually leads to a complete crash of the whole browser if I do not reload or close affected tabs in a timely manner. It takes longer without AdGuard, but AdGuard does visibly crash even when the rest of browser processes do not, in fact I have firsthand observed AdGuard crashing and it resetting to default settings (thanks to "auto-activate filters" settings, and I happen to use my computer in Turkish), then me rushing to reload tabs one by one to prevent complete browser crash.

erkinalp avatar Nov 16 '23 16:11 erkinalp

another log Has various unhandled exceptions.

erkinalp avatar Nov 17 '23 10:11 erkinalp

also a log

erkinalp avatar Nov 21 '23 06:11 erkinalp

another log Has various unhandled exceptions.

Is there a stack trace available?

2023-11-17T13:52:17:264: Cannot initialize settings from storage: An unexpected error occurred.
Stack trace:
background.js:27010:24

If not, then I will provide you with a development version that includes more detailed logs.

maximtop avatar Nov 21 '23 15:11 maximtop

Sadly no. Can you provide a debug version?

erkinalp avatar Nov 21 '23 20:11 erkinalp

Cannot initialize settings from storage

I've sent you email.

maximtop avatar Nov 22 '23 08:11 maximtop

developer version with same settings, this time with the correct log

There is no error Cannot initialize settings from storage Also, I see there are a lot of invalid rules, can you share what filters are you using?

maximtop avatar Nov 23 '23 10:11 maximtop

see configuration file

AdGuard Browser extension has nothing to do with this filter https://raw.githubusercontent.com/Yuki2718/adblock2/main/medium_mode/dynamic-rules.txt

maximtop avatar Nov 23 '23 10:11 maximtop

OK, disabled that one

erkinalp avatar Nov 23 '23 11:11 erkinalp

yet another log, this time on the release build again

Yeah, I see the error that's occurring, but it's the same one you sent previously. I need the error from the dev build because it contains extended logs.

maximtop avatar Nov 27 '23 15:11 maximtop

Do you have any more recent build? I was able to reproduce it in 4.2.220 (the development branch), but for some reason, not reflected in the logs, maybe because it is a temporary installation.

erkinalp avatar Nov 27 '23 17:11 erkinalp

maybe because it is a temporary installation.

Here is the instruction of how to test. https://extensionworkshop.com/documentation/develop/testing-persistent-and-restart-features/#what-do-i-do-to-ensure-i-can-test-my-extension

maximtop avatar Nov 28 '23 14:11 maximtop

While I had not managed to pinpoint the reason of the crash, there is a possible solution of not resetting to defaults after a crash (#2604)

erkinalp avatar Dec 05 '23 14:12 erkinalp

Worse than I thought: Manually disabling and re-enabling the extension also leaves you in that state with all filters disabled.

erkinalp avatar Dec 11 '23 14:12 erkinalp

Worse than I thought: Manually disabling and re-enabling the extension also leaves you in that state with all filters disabled.

I've tried disabling and enabling the extension but wasn't able to reproduce the issue. If it's easily reproducible on your end, could you please capture the logs for the new build I've sent you via email and share them with me?

maximtop avatar Dec 22 '23 14:12 maximtop