shadowsocks / shadowsocks-android

A shadowsocks client for Android
Other
35.06k stars 11.58k forks source link

shadowsocks-android 3.1.3 problem with shadowsockslibev 2.5.0 and 2.5.1 #876

Closed KarlM256 closed 8 years ago

KarlM256 commented 8 years ago

Please answer these questions before submitting your issue. Thanks!

What version of Shadowsocks are you using? 3.1.3 and libev 2.5.0 or 2.5.1

What Android OS version and device are you using?marshmallow

What did you do?install 3.1.3

What did you expect to see? working connection

What did you see instead?

What is your config in detail (with all sensitive info masked)? -m aes-128-ctr -p 443 -k password

Android version 3.1.0 works,3.1.1, 3.1.2 and 3.1.3 do not. The following is the log from shadowsocks libev 2.5.1

$ ./ss-server.exe -m aes-128-ctr -p 443 -k password 2016-09-11 21:04:28 INFO: initializing ciphers... aes-128-ctr 2016-09-11 21:04:28 INFO: listening at *:443 2016-09-11 21:04:58 ERROR: unable to resolve www.googletagmanager.com 2016-09-11 21:05:01 ERROR: unable to resolve www.google.com 2016-09-11 21:05:05 ERROR: unable to resolve www.google.com 2016-09-11 21:05:06 ERROR: unable to resolve www.google.com 2016-09-11 21:05:06 ERROR: getpeername: Transport endpoint is not connected 2016-09-11 21:05:09 ERROR: unable to resolve www.googletagmanager.com 2016-09-11 21:05:10 ERROR: unable to resolve www.google.com 2016-09-11 21:05:11 ERROR: unable to resolve www.google.com

The errors only start when I start the android client.

madeye commented 8 years ago

Try adding -d 8.8.8.8 to the ss-server command line.

KarlM256 commented 8 years ago

Comment shadowsocks-libev 2.5.0 ss-server.exe -m aes-128-ctr -p 443 -u -k password 2016-09-11 21:27:33 INFO: UDP relay enabled 2016-09-11 21:27:33 INFO: initializing ciphers... aes-128-ctr 2016-09-11 21:27:34 INFO: listening at *:443 2016-09-11 21:28:05 ERROR: unable to resolve ssl.google-analytics.com 2016-09-11 21:28:15 ERROR: unable to resolve ssl.google-analytics.com 2016-09-11 21:28:25 ERROR: unable to resolve ssl.google-analytics.com 2016-09-11 21:28:29 ERROR: unable to resolve www.google.com 2016-09-11 21:28:56 ERROR: unable to resolve www.google.com 2016-09-11 21:29:01 ERROR: unable to resolve www.google.com 2016-09-11 21:29:02 ERROR: unable to resolve www.google.com 2016-09-11 21:29:03 ERROR: unable to resolve www.google.com 2016-09-11 21:29:06 ERROR: unable to resolve www.google.com 2016-09-11 21:29:07 ERROR: unable to resolve www.google.com

Comment shadowsocks-libev-2.5.1/ $ ss-server.exe -m aes-128-ctr -p 443 -u -k password 2016-09-11 21:29:27 INFO: UDP relay enabled 2016-09-11 21:29:27 INFO: initializing ciphers... aes-128-ctr 2016-09-11 21:29:27 INFO: listening at *:443 2016-09-11 21:29:56 ERROR: unable to resolve www.google.com 2016-09-11 21:29:56 ERROR: unable to resolve www.google.com 2016-09-11 21:29:56 ERROR: unable to resolve www.google.com 2016-09-11 21:29:56 ERROR: unable to resolve www.google.com 2016-09-11 21:29:58 ERROR: unable to resolve www.google.com 2016-09-11 21:29:58 ERROR: unable to resolve www.google.com 2016-09-11 21:29:58 ERROR: unable to resolve www.google.com 2016-09-11 21:29:58 ERROR: unable to resolve www.google.com 2016-09-11 21:30:07 ERROR: unable to resolve www.google.com 2016-09-11 21:30:11 ERROR: unable to resolve api.accuweather.com 2016-09-11 21:30:12 ERROR: unable to resolve api.accuweather.com 2016-09-11 21:30:12 ERROR: unable to resolve www.google.com 2016-09-11 21:30:15 ERROR: unable to resolve www.google.com 2016-09-11 21:30:20 ERROR: unable to resolve www.google.com 2016-09-11 21:30:22 ERROR: unable to resolve api.accuweather.com 2016-09-11 21:30:22 ERROR: unable to resolve api.accuweather.com 2016-09-11 21:30:25 ERROR: unable to resolve www.google.com 2016-09-11 21:30:28 ERROR: unable to resolve www.google.com 2016-09-11 21:30:30 ERROR: unable to resolve www.google.com 2016-09-11 21:30:31 ERROR: unable to resolve ssl.google-analytics.com

KarlM256 commented 8 years ago

I didn't intend to past so fast.

With shadowsocks-android 3.1.0, it works. I can browse and test connection works. With shadowsocks-androis 3.1.3, I cannot browse and test connection fails.

The errors only occur with a 3.1.3 version client. The 3.1.0 client is fine and no errors in the libev log for either 2.5.0 or 2.5.1.

madeye commented 8 years ago

Please follow https://github.com/shadowsocks/shadowsocks-android/issues/876#issuecomment-246239859.

madeye commented 8 years ago

Also, as mentioned in https://github.com/shadowsocks/shadowsocks-libev/issues/823#issuecomment-246157354, you should not run ss-server on Cygwin, which is not supported.

KarlM256 commented 8 years ago

With -d 8.8.8.8, both libev 2.5.0 and 2.5.1 work without error.

Why does shadowsocks-android 3.1.3 require -d 8.8.8.8 on the server and 3.1.0 does not? Why does it not use my local DNS server for 3.1.3 as it does for 3.1.0?

madeye commented 8 years ago

/etc/resolv.conf is required for DNS auto-config, which is not supported by Cygwin.

KarlM256 commented 8 years ago

I just added a /etc/resolv.conf containing the address of my local DNS (on the same machine as the libev server). This works fine now for android 3.1.3 without the -d 8.8.8.8, but the delay is about 40 ms slower than using the 3.1.0 android client without the resolv.conf.

Any idea why?

madeye commented 8 years ago

Use a local DNS server instead of 8.8.8.8.

KarlM256 commented 8 years ago

I did try a local DNS server in the resolv.conf. That worked, but 8.8.8.8 was faster. So it is just the delay of my local DNS server in recursive mode.

So why move DNS resolution from the client to the server?

madeye commented 8 years ago
  1. Avoid DNS cache poisoning on the client.
  2. Improve GEO-IP based CDN performance.
KarlM256 commented 8 years ago

OK thanks.