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

No reconnection after 'Connection reset by peer' #1414

Closed
5 of 19 tasks
HankAviator opened this issue Oct 16, 2017 · 18 comments
Closed
5 of 19 tasks

No reconnection after 'Connection reset by peer' #1414

HankAviator opened this issue Oct 16, 2017 · 18 comments

Comments

@HankAviator
Copy link

HankAviator commented Oct 16, 2017

Please read FAQ then answer these questions before submitting your issue. Thanks!

Environment

  • Android version: 7.1.2, LineageOS 14.1
  • Device: OnePlus One
  • Shadowsocks version: 4.2.5
  • Last version that did not exhibit the issue (if applicable): N/A

Configuration

Put an x inside the [ ] that applies.

  • IPv4 server address
  • IPv6 server address
  • Client IPv4 availability
  • Client IPv6 availability
  • Local port: 1080
  • Encrypt method: RC4-MD5
  • One-time authentication
  • Route
    • All
    • Bypass LAN
    • Bypass China
    • Bypass LAN & China
    • GFW List
    • China List
    • Custom rules
  • IPv6 route
  • Per-App Proxy
    • Bypass mode
  • Remote DNS: 8.8.8.8
  • DNS Forwarding
  • Plugin configuration (if applicable):
  • Auto Connect
  • TCP Fast Open
  • NAT mode

What did you do?

Launch shadowsocks normally and use other apps. In a irregular phase, shadowsocks writes a line of

E shadowsocks: remote_recv_cb_recv: Connection reset by peer

into logcat. Right after this line, all network traffic is unavailable, including China, LAN and GFWed traffic.

Note: On marshmallow, shadowsocks seems to be correctly resuming the connection, though still sometimes it requires manual intervention (turn off then back on).
Tried to uninstall, reinstall (by offline apk via package manager or Google Play), clear data, checked task-kill utilities and all possible whitelists have ss included. Even set highest process priority and permanent for shadowsocks:bg.

What did you expect to see?

Shadowsocks should try to reconnect even the connection is reset.

What did you see instead?

No reconnection and all connections are obstructed.
No other lines in log are relevant so I'm not posting here. They are well kept and will be uploaded on demand.
App IS NOT killed, bothshadowsocks:bg and shadowsocks:sh are still running.

@HankAviator
Copy link
Author

HankAviator commented Oct 16, 2017

shadowsocks has already been put into whitelist of Battery Optimization and Unrestricted data access (in data saver).

@madeye
Copy link
Contributor

madeye commented Oct 17, 2017

First of all, try VPN mode instead.

According to your description, it looks a network issue. To verify that background processes are not killed, please run the following command in the adb shell:

ps aux | grep shadowsocks

@HankAviator
Copy link
Author

VPN mode so far so good. Monitoring any further peculiar event.

@HankAviator
Copy link
Author

HankAviator commented Oct 17, 2017

NAT mode, log captured as below:

bacon:/ $ ps | grep shadowsocks
u0_a233   6494  361   1334824 71056 sys_epoll_ 00000000 S com.github.shadowsocks:bg
u0_a233   26391 6494  4600   1996  sys_epoll_ 00000000 S /data/app/com.github.shadowsocks-1/lib/arm/libredsocks.so
u0_a233   26395 6494  5504   2608  sys_epoll_ 00000000 S /data/app/com.github.shadowsocks-1/lib/arm/libss-local.so
u0_a233   26402 6494  843972 14768 futex_wait 00000000 S /data/app/com.github.shadowsocks-1/lib/arm/liboverture.so

process was alive. adb connected via WiFi (LAN).

@madeye
Copy link
Contributor

madeye commented Oct 18, 2017

NAT mode has been deprecated for years. Make sure you're using VPN mode at first.

@wongsyrone
Copy link
Contributor

using VPN mode

You might want to update tun2socks which have latest lwip included.

@HankAviator
Copy link
Author

Update: VPN mode delayed some notifications (WeChat) while minutes later also stopping all traffic. This happened only after a night of screen off. Didn't get any log since it might oversize. Not sure if it's yielded by Doze. Turned off some experimental features in Greenify, reset Amplify restriction rules and I'll keep watching.

@HankAviator
Copy link
Author

HankAviator commented Oct 18, 2017

VPN Mode logcat when network unavailable (only interesting parts):

10-18 18:21:24.485  2065  2065 D tun2socks: ERROR(BConnection): connection failed
10-18 18:21:24.485  2065  2065 D tun2socks: ERROR(BSocksClient): connection failed
10-18 18:21:25.125  2065  2065 D tun2socks: ERROR(BConnection): connection failed
10-18 18:21:25.125  2065  2065 D tun2socks: ERROR(BSocksClient): connection failed
10-18 18:22:10.458  2065  2065 D tun2socks: ERROR(BConnection): recv failed
10-18 18:22:11.739  2065  2065 D tun2socks: ERROR(BConnection): recv failed
10-18 18:22:13.658  2065  2065 D tun2socks: ERROR(BConnection): recv failed
10-18 18:22:14.901  2184  2238 I ActivityManager: Displayed eu.chainfire.supersu/.PromptActivity: +374ms
10-18 18:22:14.967  1957  4258 I overture: time="2017-10-18T10:22:14Z" level=warning msg="Dial DNS upstream with SOCKS5 proxy failed: proxy: failed to read greeting from SOCKS5 proxy at 127.0.0.1:1080: read tcp 127.0.0.1:40174->127.0.0.1:1080: read: connection reset by peer" 

Frequency reduced from each 1 hour (NAT mode) to 2 - 3 times a day (VPN mode)
ps shows shadowsocks:bg was still running in the background, along with other dependencies.
Still no reconnection.

@madeye
Copy link
Contributor

madeye commented Oct 19, 2017

As per your log, the ss-local process should be killed already.

My suggestion is trying other ROMs, e.g. the official ROM from OnePlus.

@HankAviator
Copy link
Author

HankAviator commented Oct 19, 2017

I've run ps right after the network anomaly and the process list was the same as aforementioned in NAT mode debugging, note this list is the same when ss works normally, processes were still there but seems the module within wouldn't function properly. Maybe Xposed framework caused some crash to socket yada yada as I see logcat was spammed by relevant errors.

@denniskrol
Copy link

Since I installed Xposed 88.1 I have the same problem. As soon as I disable Xposed (and reboot) Shadowsocks works again.

@HankAviator
Copy link
Author

HankAviator commented Oct 20, 2017

Reopened for reminder purpose.

Known faulty modules which may disrupt shadowsocks: Amplify, (suspicious) AppSettings.

@HankAviator HankAviator reopened this Oct 20, 2017
@denniskrol
Copy link

This is kinda off-topic, but in case anybody ever finds this with Google:
Always Expandable Notifications (http://repo.xposed.info/module/com.mohammadag.alwaysexpandablenotifications) broke it. It fucks with the persistent notification, and Shadowsocks doesn't seem to like it.
All Notifications Expanded (http://repo.xposed.info/module/com.ugglynoodle.allnotificationsexpanded) does the same, and does work.
I enabled Amplify again (does that even work for Android 7?) and Shadowsocks still works.

@HankAviator
Copy link
Author

In my case Amplify floods log and might due to unable to hook on some classes. Anyways, disabled for now. Monitoring other modules to see any can be also suspicious - or it was the framework itself.

@Mygod Mygod closed this as completed in a2df7a7 Oct 20, 2017
@Mygod
Copy link
Contributor

Mygod commented Oct 20, 2017

We are not going to support incompatibilities with Xposed framework and/or modules. Please report this bug to them instead.

Feel free to keep the conversation going in this thread.

@HankAviator
Copy link
Author

It might be due to OOM on my old device OnePlus One (bacon) or LoS build too. Not sure which caused it.
On mi 6 (sagit) all is good even with xposed v89

bannedbook pushed a commit to bannedbook/SpeedUp.VPN that referenced this issue Dec 25, 2019
@Sarun2515
Copy link

เราจะไม่สนับสนุนความไม่เข้ากันกับกรอบงานและ/หรือโมดูล Xposed โปรดรายงานข้อบกพร่องนี้ให้พวกเขาทราบแทน

โปรดอย่าลังเลที่จะสนทนาต่อในกระทู้นี้

@Sarun2515
Copy link

**
Duplicate of #**

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