Shadowsocks-android: No send/recv traffic after a while on Samsung S9+

Created on 30 Mar 2018  ·  10Comments  ·  Source: shadowsocks/shadowsocks-android

This issue is similar with another issue (#1410), but the symptom seems to be different. So I decided to open a new issue.

Environment

  • Android version: 8.0.0
  • Device: Samsung S9+ (SM-G9650/DS) [Dual-Sim (Qualcomm)]
  • Shadowsocks version: 4.5.2
  • Last version that did not exhibit the issue (if applicable):

Configuration

_Put an x inside the [ ] that applies._

  • [x] IPv4 server address
  • [ ] IPv6 server address
  • [x] Client IPv4 availability
  • [ ] Client IPv6 availability
  • Encrypt method:
  • Route

    • [ ] All

    • [ ] Bypass LAN

    • [ ] Bypass China

    • [x] Bypass LAN & China

    • [ ] GFW List

    • [ ] China List

    • [ ] Custom rules

  • [x] IPv6 route
  • [x] Apps VPN mode

    • [x] Bypass mode

  • Remote DNS: 8.8.8.8
  • [x] DNS Forwarding
  • Plugin configuration (if applicable):
  • [x] Auto Connect
  • [x] TCP Fast Open
  • If you're not using VPN mode, please supply more details here:

Samsung Related Configuration

  • Unmonitored shadowsocks in "Settings -> Device maintenance"
  • Locked shadowsocks in recent apps
  • No optimization apps installed (Greenify, brevent, etc.. )

What did you do?

  1. Boot up the device, the ss service auto connected.
  2. Enjoy the internet (1hrs ~ 2days)
  3. Unable to access the internet via ss. (ss shows: Connect success / send 0KB 0 Bytes/s | recv 0KB 0 Bytes/s )
  4. Try to connect to different servers via ss -> no send/recv traffic
  5. Try to connect to the servers mentioned above (on other devices, under same network) -> the server seems ok.

Methods I tried but still no send/recv traffic:

  • Disable / Enable service in shadowsocks
  • Kill / Start shadowsocks app (mentioned in #1410)
  • Change socks5 proxy port (mentioned in #1410)
  • Settings -> General Management -> Reset -> Reset network settings (mentioned in #1410)

Other attempts:

  • Use outline or other VPN apps unrelated to ss protocol (still no send/recv traffic)
  • Connect to baidu without VPN services -> success

It seems that the only method to solve this problem temporarily is reboot.

I thought it's a bug related to VPN services in the Samsung OS, but I can hardly find similar issues on google (https://github.com/shadowsocks/shadowsocks-android/issues/1712#issuecomment-377424988) , so I wonder if some specific usage in ss triggered this bug in Samsung OS.

third-party bug

Most helpful comment

Tip on switching slowly: Shut down VPN, switch profile then start again.

It's a race condition. It doesn't happen every time. If you try it for an hour it will probably happen.

Shadowsocks does change the route. It tells netd which route to add to VPN tunnel otherwise no traffic will go through VPN.

All 10 comments

Thanks for the very helpful logcat. Unfortunately Netd and ConnectivityService are both system components. So I think this might be a bug of your ROM.

Does this issue also occur for 4.5.1? Does other VPN app works with your device?

my s8 has a problem, when you touch the circle button which start to connect, it doesn't work, you can't get any responses

but last version works well

I meant do you observe the similar behavior for other VPN apps before everything breaks down?

@Mygod I think maybe no one can keep a VPN connected for days? 😃

@madeye Maybe but unlike real VPNs, Shadowsocks is stateless.

@Coxxs Try switching between Wi-Fi and cellular networks frequently and see if that makes it happen more often. I'm suspecting some race condition somewhere.

It would probably be most helpful if you could get a logcat just after when connectivity is lost.

If possible, please also run adb shell ip addr.

Thanks. That's very helpful. I also tried your way on my Lineage OS for ~20 seconds and nothing happened.

Looking at your logcat, the most relevant lines are:

03-30 15:19:19.185   948  1229 E Netd    : Error deleting IPv4 rule: No such file or directory
03-30 15:19:19.185   948  1229 E Netd    : failed to remove interface tun0 from VPN netId 506
03-30 15:19:19.185   948  1229 E Netd    : deleting network with netId 506 without clearing its interfaces
03-30 15:19:19.186  1523  1778 E ConnectivityService: Exception removing network: java.lang.IllegalStateException: command '120 network destroy 506' failed with '400 120 destroyNetwork() failed (No such file or directory)'

This is almost certainly a race condition. Unfortunately it's impossible to debug it because we don't have access to Samsung's source code.

Also good job finding that related issue. Now I'm certain there's nothing to do here since you can reproduce it also with airplane mode. Please wait for Samsung to release a fix. (you could also contact their support staff)

Tip on switching slowly: Shut down VPN, switch profile then start again.

It's a race condition. It doesn't happen every time. If you try it for an hour it will probably happen.

Shadowsocks does change the route. It tells netd which route to add to VPN tunnel otherwise no traffic will go through VPN.

Seems 9.0 Beta fixed this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

libook picture libook  ·  4Comments

zhangchunsheng picture zhangchunsheng  ·  3Comments

mahdiG picture mahdiG  ·  4Comments

Mygod picture Mygod  ·  5Comments

Edelwiess picture Edelwiess  ·  6Comments