Repository: blokadaorg/blokada

Issue #646: Blokada closes protection for a short while by starting WIFI
Created: 2020-02-10T11:01:15Z
Connecting to WIFI
Blokada protection stops for a short while
After a few seconds Blokada restarts

Expected behaviour
Connecting to WIFI should not shut down protection for a short while.
With data network there's no problem like this.
Configuration


Blokada version: 4.5.2


Device model
Samsung S10 (A10)


Android version / ROM
Android One UI


Questions


How long have you been using Blokada?
One month


How long time ago has the problem started to happen?
At least since 4.5.1


How often does this problem happen to you?
every time

Duplicate issue #668: Blokada reconnects local VPN multiple times when changing the connection, e.g. on WiFi (re)connect. This interrupts on-going data traffic, as if there are multiple connection outages
Created: 2020-03-17T18:42:53Z
--- Actual behaviour ---
When I open Blokada and press the connect button, everything works great. The local VPN connection is established and blocking works as expected. The problem I mentioned notably occurs when there is a disconnect (e.g. WiFi gone, other WiFi access point, etc.). The VPN stays connected for a few seconds, then disconnects, connects, disconnects and connects once again. Unfortunately this can occur a few more times, especially when activating and disabling the local Blokada VPN from the permanent notification. This also occurs when toggling through the frequency of filter list updates in the settings. The way Blokada behaves with these multiple local VPN reconnections causes connection problems when an Internet connection was lost and re-established. Especially when playing online games this can be very frustrating. As it can take up about 10 - 30 seconds until there is no more interruption due to the constant VPN reconnects, which can even seriously confuse games with intolerant network code (like Clash Royale), requiring a full game restart. Which sadly makes this unwanted behavior more infuriating in these situations. I also noticed the VPN reconnect can interrupt traffic from apps like Google Play Services, which makes the Google Play Services not bother to try again whatever it was doing.
To help you imagine this: Blokada is turned on; it was already set to "on" before. A few seconds later WiFi is turned on. Once connected, background apps like Google Play Services do their background traffic things. A few seconds later, Blokada (re)creates its local VPN connection. Suddenly all traffic has stopped, even though it's traffic that isn't on any blacklist. Then there often are 1 - 2 more Blokada VPN reconnections, until it's all fine again.
--- Expected behaviour ---
The local Blokada VPN should either stay permanently on, even when there is no active Internet connection. This would ensure there is no interruption in data traffic once Blokada has been turned on.
Or Blokada should only briefly interrupt the Internet connection by establishing the local VPN only once, without any weird further VPN disconnections.
Alternatively, there should be a grace period (for example 1 minute) before Blokada triggers a VPN disconnect. This ensures that the Internet connection won't be interrupted again, once a WiFi or mobile connection is back. However, it would be still important to get rid of these extra reconnections, because they can be still very annoying and appear to be superfluous.
Steps to reproduce
I'm going to describe two ways to spot this:

Turn off WiFi and then activate Blokada from the main page. Blokada has created the local VPN. Don't wait, immediately continue.
Activate WiFi again.
Alternatively, quickly switch WiFi off and on to simulate a situation with a lost WiFi connection.
Blokada recreates the VPN connection multiple times, which interrupts ongoing Internet traffic

Here is the other way. Make sure to turn off Blokada and exit it completely.

Turn off WiFi. activate Blokada from the main page.
Wait until Blokada shows "Blokada is active".
Turn on WiFi.
Blokada shows "Please wait...", the local VPN was destroyed again.
After a few seconds, the VPN is back again. "Blokada is active".
Blokada often repeats step 4 and 5 one more time.
Now disable WiFi.
Blokada shows "Please wait...", destroyed VPN, shows "Waiting for network...", recreates VPN once again
Now enable WiFi.
Blokada shows a slight delay when it creates the local VPN, and a few seconds later it repeats step 4 and 5 (recreated the local VPN for no apparent reason).

Well, okay, there is also a third way to test this 😛

Turn off WiFi, activate Blokada.
Repeatedly turn WiFi on and off. Make sure the phone could actually connect to a WiFi access point.
Watch how Blokada behaves.

--- Configuration ---

Blokada version: 4.5.2
Device model: Xiaomi Redmi Note 5
Android version / ROM: 8.1, Resurrection Remix ROM

Note: I could verify this on another device, a Redmi 2 running Android 7.1.2. Even though that's probably a topic on its own, since on that system I encountered inconsistent behavior when Blokada turns on its local VPN.
--- Questions ---


Do you know about recent updates (for example system update, security patch update)?
System is from 2018, including patch date.


How often does this problem happen to you?
Sadly so often that it discourages me from using Blokada.


If you need more info or the log from app itself, please let me know. Thank you!

Closing comment (2020-03-21T10:44:31Z): This looks to be a duplicate of #646 , no?