Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCM notification delay, GCM connection interupted #3956

Closed
1 task
JhonHuGit opened this issue Aug 30, 2021 · 19 comments
Closed
1 task

GCM notification delay, GCM connection interupted #3956

JhonHuGit opened this issue Aug 30, 2021 · 19 comments

Comments

@JhonHuGit
Copy link

JhonHuGit commented Aug 30, 2021

Prerequisites

  • [*] I am running the latest version
  • [*] I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed

Issue Details

  • AdGuard version:
    3.6.2
  • Filtering mode:
    Local VPN with shadowsocks outbound
  • Device:
    Samsung s20 ultra snapdragon with Chinese rom
  • Operating system and version:
    Android 11 / oneui 3.1
  • Root access:
    no

Expected Behavior

This issue is concerned about GCM notification. I cannot connet GCM and most google services due to my local government policy. So I am using shadowsocks as a proxy and adguard as vpn. My mobile network has a 20 mininutes timeout, so I used an app to send a heartbeat package every 5 minutes to keep GCM connection alive.
I have disabled battery optimization for nearly every app.
GCM connetion will keep alive.

Actual Behavior

When using mobile network and screen off, GCM disconnets ramdomly. This situation does not happen when screen is on or the phone charges or with wifi.
Strangely, this disconnetion usually happens when using ipv4, with ipv6 working but not filtered, the problem seems gone.

Logs and fcm diagnostics screenshots are attached below.

Screenshots

ipv4_adguard_logs_3 6 23_3008_174100
ipv4_adguard_logs_3.6.23_3008_174100.zip
ipv6_adguard_logs_3 6 23_3008_181059
Uploading ipv6_adguard_logs_3.6.23_3008_181059.zip…

@Disqu3-mirOir-qt
Copy link

adguard not use GCM (google cloud messaging) it,s use own socket

@JhonHuGit
Copy link
Author

I am sorry if I don't make myself clear. The problem is when using adguard with shadowsocks, adguard seems to break some local connections. And with other current situation of isp(20 minutes heartbeat, lesser than 28 minutes of google heartbeat), it leads to GCM connection/notification problem

@JhonHuGit
Copy link
Author

I find it connects successfully when getting results from '143.95.251.89:80: 128', but when getting results from '143.95.251.89:80: 32', it will fail.
143.95.251.89:80 is the ip my app trying to reach, so the difference is 128 or 32. I think maybe this is the problem

@Chinaski1
Copy link
Member

It seems to me that this issue may be related to recent updates on the One UI 3.0 and 3.1 shell on Android 11, Samsung changed its policy on closing apps running in the background.
When the screen is locked, some applications are not able to work correctly.

To make sure your favorite apps don’t get killed unexpectedly and work as intended on your Galaxy device running Android 11, head to Settings > Apps > “Your App” > Battery > Battery Optimization > All Apps > “Your app” > Don’t optimize.

@JhonHuGit
Copy link
Author

I have put almost every app into 'Don’t optimize' status. But the problem is still there.
When enable pref.vpn.ipv6.bypass instead of pref.vpn.ipv6.disable, GCM connection seems to be more stable. The change may be that with pref.vpn.ipv6.bypass, GCM uses ipv6 channel other than ipv4.

@Chinaski1
Copy link
Member

I think you can try enabling AdGuard in Always-on-VPN mode maybe this will help in solving the issue.

@JhonHuGit
Copy link
Author

Tried this, the problem still exists

@admitrevskiy
Copy link

@JhonHuGit Hi!
Could you try to reproduce the issue with only shadowsocks in VPN mode?

@JhonHuGit
Copy link
Author

Tried yesterday evening, shadowsocks alone worked fine. GCM connects steably.

@JhonHuGit
Copy link
Author

Update adguard to 3.6.4, and use another samsung s20 ultra with latest system patch, the problem is gone both in ipv4 and ipv6 environment.

@Birbber
Copy link
Contributor

Birbber commented Sep 23, 2021

@JhonHuGit Thanks for the update!
I'm closing this issue now. If it reoccurs, please reopen it.

@JhonHuGit
Copy link
Author

update: the problem is back again. Here is how I tried and the results
a) shadowsocks in proxy only mode, adguard with pref.vpn.ipv6.disable enabled. GCM connection is unstable. It will disconnect randomly.
b) shadowsocks in proxy only mode, adguard with pref.vpn.ipv6.bypass enabled. GCM connects in ipv6 channel and will be much more stable. The problem is not ipv6 is not available everywhere, when disconnected, it will fall back to ipv4 and seldom connect to ipv6.
These two situations have one problem in common, during night time, GCM connection will disconnect.
c) shadowsocks in vpn mode. All problems are gone, except I cannot filter ads.

I searched the internet and find Samsung has something called local battery policy which has no way to disable except for a foreign SIM card. I first presume that a) and b) problems is related to this stupid policy, but I am wondering why c) is OK.

Anyway, I will keep trying and update. Hope version 4.0 or Samsung new oneui will somehow solve the problem.

Just saying, is it possible for you to add more filter rules to your public dns, for example, some more Chinese filter rules? (・ω<)

@Birbber
Copy link
Contributor

Birbber commented Oct 4, 2021

@JhonHuGit Could you file an issue with more details in filters repository? Make sure to mention the domains you'd like to block.

@JhonHuGit
Copy link
Author

I don‘t know exactly what domain is about the ads. Here are the filters I am using. (Sorry about the Chinese because I don't know how to translate them to English)
Adguard 基础过滤器
Adguard 移动广告过滤器
Adguard 防跟踪保护过滤器
Adguard 社交媒体过滤器
在线恶意url拦截列表
spam 404
NoCoin 过滤列表
Adguard 恼人广告过滤器
Adguard 中文过滤器
解除搜索广告和自我推销过滤器
This works well for me, but when I use Adguard dns which is dns.adguard.com only, some ads cannot be filtered, for example ads on www.v2ex.com.

@Birbber
Copy link
Contributor

Birbber commented Oct 5, 2021

@JhonHuGit You can report this issue via Support --> Send feedback --> Missed ad or tracker and mention the webpage/es you faced the issue on.
Fill the form up with all the information required. The issue will be created on filters repository.

@JhonHuGit
Copy link
Author

JhonHuGit commented Nov 8, 2021

UPDATE:
GCM connection seems normal when I enable pref.vpn.ipv4.force.default in lower settings.
I will keep an eye on this issue and update if there the problem comes back.
Meanwhile, would you please do some digging on this problem, maybe it can make adguard better.

FYI: my settings are as follows
Samsung S20 Ultra, Chinese version
adguard with shadowsocks
shadowsocks settings: proxy only mode
system settings: vpn always on
adguard settings: dns server: shadowsocks 127.0.0.1:5450
vpn mode with shadowsocks proxy 127.0.0.1:1080
lower settings: pref.vpn.ipv4.force.default enabled
pref.vpn.ipv6.disable enabled
pref.excluded.packages: delete uid 10000

@JhonHuGit
Copy link
Author

UPDATE:
the problem is back again, still looking for solutions

@admitrevskiy
Copy link

@JhonHuGit Hi! Is there any news on this issue?
Could you please collect debug logs with the latest stable version?

  • Go to Settings -> Advanced -> Logging level -> Record everything;
  • Enable pcap file capturing: go to Settings -> Advanced -> Low-level settings -> pref.vpn.capture;
  • Reproduce the issue;
  • Remember the exact time when the issue was reproduced, we will need it to find the corresponding records in the log file;
  • Send received archive to devteam@adguard.com. Mention the Github issue number and the exact time when the issue was reproduced;
  • It would be nice if you sent FCM diagnostics screenshots as well.

@stale
Copy link

stale bot commented Mar 2, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants