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

启用 KCP 后上传“超速”的问题 #460

Closed
hyxxsfwy opened this issue Jun 1, 2017 · 5 comments
Closed

启用 KCP 后上传“超速”的问题 #460

hyxxsfwy opened this issue Jun 1, 2017 · 5 comments

Comments

@hyxxsfwy
Copy link

hyxxsfwy commented Jun 1, 2017

提交 Issue 之前请先阅读 Issue 指引,然后回答下面的问题,谢谢。

  1. 你正在使用哪个版本的 V2Ray?(如果服务器和客户端使用了不同版本,请注明)
  • V2Ray v2.31
  1. 你的使用场景是什么?比如使用 Chrome 通过 Socks/VMess 代理观看 YouTube 视频。
  • Mux+Vmess+kcp,使用 Dropbox 客户端通过 V2Ray 的 Socks5 代理上传文件。
  1. 你看到的不正常的现象是什么?
  • 上传不正常。
    在流量监控程序中可以看到,整个上传过程是这样的:
    Dropbox 客户端以 4MB 为单位,将数据传给 V2Ray 客户端,然后 V2Ray 开始以超过电信带宽限制的速度上传数据。我这电信给的上传速度只有 256 KB/s,而 V2Ray 客户端上传的速度在 500 KB/s ~ 1 MB/s ,从路由器的流量监控上也能证实,不是流量监控程序出错了。
    按说传的快当然是好事,说不定是电信的 QOS 管不好 UDP 呢。然而,这么“高速上传”的结果是,文件根本传不上去。上传一个 20MB 的文件,等 5 分钟到流量监控里去看,V2Ray 一直保持上传,传了 180 MB 多的数据。同时,Dropbox 客户端向 V2Ray 进程发送了 40 MB 的数据,已经两倍于待上传文件的大小了。但此时,Dropbox 客户端依然没有完成上传。
  1. 你期待看到的正确表现是怎样的?
  • Dropbox 客户端经由 V2Ray 代理,能够正常的上传文件。
    PS:已经尝试各种调整 KCP 配置参数,并没有什么效果。
    这应该是 KCP 的老问题,参见这个 issue:上传超过运营商带宽正常吗? xtaci/kcptun#295
    还有,用 Dropbox 网页版是能把文件传上去的,但上传数据量依然是文件体积的数倍。
  1. 请附上你的配置文件(提交 Issue 前请隐藏服务器端IP地址)。

    Server Configuration File(服务器端配置文件):

{
  "log": {
    "access": "/var/log/v2ray/access.log",
    "error": "/var/log/v2ray/error.log",
    "loglevel": "warning"
  },
  
  "inbound": {
    "port": 8787,
    "protocol": "vmess",
    "settings": {
      "clients": [
        {
          "id": "***",
          "level": 1,
          "alterId": 64,
          "email": "***"
        },
        {
          "id": "***",
          "level": 0,
          "alterId": 32,
          "email": "test001@example.com"
        }
      ]
    },
    "streamSettings": {
      "network": "kcp"
    }
  },

  "outbound": {
    "protocol": "freedom",
    "settings": {}
  },

  "inboundDetour": [
    {
      "port": 18787,
      "protocol": "vmess",
      "tag": "dynamic_port",
      "settings": {
        "clients": [
          {
            "id": "***",
            "level": 1,
            "alterId": 64,
            "email": "***"
          },
          {
            "id": "***",
            "level": 0,
            "alterId": 32,
            "email": "test001@example.com"
          }
        ],
        "detour": {
          "to": "tcp_bbr"
        }
      },
      "streamSettings": {
        "network": "tcp"
      }
    },
    {
      "port": "30001-30100",
      "protocol": "vmess",
      "tag": "tcp_bbr",
      "settings": {},
      "allocate": {
        "strategy": "random",
        "concurrency": 2,
        "refresh": 5
      },
      "streamSettings": {
        "network": "tcp"
      }
    }
  ],

  "outboundDetour": [
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "blocked"
    }
  ],
  
  "routing": {
    "strategy": "rules",
    "settings": {
      "rules": [
        {
          "type": "field",
          "ip": [
            "0.0.0.0/8",
            "10.0.0.0/8",
            "100.64.0.0/10",
            "127.0.0.0/8",
            "169.254.0.0/16",
            "172.16.0.0/12",
            "192.0.0.0/24",
            "192.0.2.0/24",
            "192.168.0.0/16",
            "198.18.0.0/15",
            "198.51.100.0/24",
            "203.0.113.0/24",
            "::1/128",
            "fc00::/7",
            "fe80::/10"
          ],
          "outboundTag": "blocked"
        }
      ]
    }
  },
  
  "transport": {
    "tcpSettings": {
      "connectionReuse": true,
      "header": {
        "type": "none"
      }
    },
    "kcpSettings": {
      "mtu": 800,
      "tti": 50,
      "uplinkCapacity": 30,
      "downlinkCapacity": 50,
      "congestion": true,
      "readBufferSize": 1,
      "writeBufferSize": 1,
      "header": {
        "type": "wechat-video"
      }
    }
  }
}
Client Configuration File(客户端配置文件):
{
  "log": {
    "loglevel": "debug"
  },
  
  "inbound": {
    "protocol": "socks",
    "port": 10086,
    "listen": "127.0.0.1",
    "settings": {
      "auth": "noauth",
      "udp": true,
      "ip": "127.0.0.1",
      "timeout": 0
    }
  },
  
  "inboundDetour": [
    {
      "protocol": "http",
      "port": 10087,
      "listen": "127.0.0.1",
      "settings": {
        "timeout": 0
      }
    },
    {
      "protocol": "dokodemo-door",
      "port": 25353,
      "listen": "127.0.0.1",
      "settings": {
        "address": "8.8.8.8",
        "port": 53,
        "network": "tcp,udp",
        "timeout": 0
      }
    }
  ],
  
  "outbound": {
    "protocol": "vmess",
    "settings": {
      "vnext": [
        {
          "address": "***",
          "port": 8787,
          "users": [
            {
              "id": "***",
              "level": 1,
              "alterId": 64,
              "security": "aes-128-gcm",
              "email": "***"
            }
          ]
        }
      ]
    },
    "streamSettings": {
      "network": "kcp"
    },
    "mux": {
      "enabled": true,
      "concurrency": 8
    }
  },
  
  "outboundDetour": [
    {
      "protocol": "freedom",
      "tag": "direct",
      "settings": {}
    },
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "blocked"
    }
  ],

  "dns": {
    "servers": [
//    "114.114.114.114",
//    "223.5.5.5",
      "localhost"
    ]
  },
  
  "routing": {
    "strategy": "rules",
    "settings": {
      "domainStrategy": "AsIs",
      "rules": [
        {
          "type": "field",
          "ip": [
            "0.0.0.0/8",
            "10.0.0.0/8",
            "100.64.0.0/10",
            "127.0.0.0/8",
            "169.254.0.0/16",
            "172.16.0.0/12",
            "192.0.0.0/24",
            "192.0.2.0/24",
            "192.168.0.0/16",
            "198.18.0.0/15",
            "198.51.100.0/24",
            "203.0.113.0/24",
            "::1/128",
            "fc00::/7",
            "fe80::/10"
          ],
          "outboundTag": "direct"
        }
      ]
    }
  },
  
  "transport": {
    "tcpSettings": {
      "connectionReuse": true,
      "header": {
        "type": "none"
      }
    },
    "kcpSettings": {
      "mtu": 800,
      "tti": 50,
      "uplinkCapacity": 5,
      "downlinkCapacity": 20,
      "congestion": true,
      "readBufferSize": 1,
      "writeBufferSize": 1,
      "header": {
        "type": "wechat-video"
      }
    }
  }
}
  1. 请附上出错时软件输出的日志。在 Linux 中,日志通常在 /var/log/v2ray/error.log 文件中。

    Server Log File(服务器端日志):

2017/06/01 20:11:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30088: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:11:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30041: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:16:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30017: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:16:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30025: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:21:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30050: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:21:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30069: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:26:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30071: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:26:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30053: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:31:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30072: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:31:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30022: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:36:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30067: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:36:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30085: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:41:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30088: use of closed network connection] > Retry: all retry attempts failed
2017/06/01 20:41:01 [Warning]Transport|Internet|TCP: failed to accepted raw connections > Retry: [accept tcp [::]:30100: use of closed network connection] > Retry: all retry attempts failed
Client Log File(客户端日志):
V2Ray v2.31 (One for all) 20170530
An unified platform for anti-censorship.
2017/06/01 20:09:04 [Debug]App|Proxyman|Inbound: creating tcp worker on 127.0.0.1:10086
2017/06/01 20:09:04 [Debug]App|Proxyman|Inbound: creating tcp worker on 127.0.0.1:10087
2017/06/01 20:09:04 [Debug]App|Proxyman|Inbound: creating tcp worker on 127.0.0.1:25353
2017/06/01 20:09:04 [Info]Transport|Internet|TCP: listening TCP on 127.0.0.1:10086
2017/06/01 20:09:04 [Info]Transport|Internet|UDP: listening UDP on 127.0.0.1:10086
2017/06/01 20:09:04 [Info]Transport|Internet|TCP: listening TCP on 127.0.0.1:10087
2017/06/01 20:09:04 [Info]Transport|Internet|TCP: listening TCP on 127.0.0.1:25353
2017/06/01 20:09:04 [Info]Transport|Internet|UDP: listening UDP on 127.0.0.1:25353
2017/06/01 20:09:04 [Warning]Core: V2Ray started
2017/06/01 20:09:34 [Info]Proxy|Socks: TCP Connect request to tcp:bolt.dropbox.com:443
2017/06/01 20:09:34 [Info]App|Dispatcher|Default: default route for tcp:bolt.dropbox.com:443
2017/06/01 20:09:34 [Info]App|Proxyman|Mux: dispatching request to tcp:bolt.dropbox.com:443
2017/06/01 20:09:34 [Info]Transport|Internet|mKCP: dialing mKCP to udp:Server_IP:8787
2017/06/01 20:09:34 [Info]Transport|Internet|mKCP: creating connection 21733
2017/06/01 20:09:34 [Info]Proxy|VMess|Outbound: tunneling request to tcp:v1.mux.cool:9527 via tcp:Server_IP:8787
2017/06/01 20:09:39 [Info]Proxy|Socks: TCP Connect request to tcp:bolt.dropbox.com:443
2017/06/01 20:09:39 [Info]App|Dispatcher|Default: default route for tcp:bolt.dropbox.com:443
2017/06/01 20:09:39 [Info]App|Proxyman|Mux: dispatching request to tcp:bolt.dropbox.com:443
2017/06/01 20:09:51 [Info]Proxy|Socks: TCP Connect request to tcp:client-cf.dropbox.com:443
2017/06/01 20:09:51 [Info]App|Dispatcher|Default: default route for tcp:client-cf.dropbox.com:443
2017/06/01 20:09:51 [Info]App|Proxyman|Mux: dispatching request to tcp:client-cf.dropbox.com:443
2017/06/01 20:09:58 [Info]Proxy|Socks: TCP Connect request to tcp:client-cf.dropbox.com:443
2017/06/01 20:09:58 [Info]App|Dispatcher|Default: default route for tcp:client-cf.dropbox.com:443
2017/06/01 20:09:58 [Info]App|Proxyman|Mux: dispatching request to tcp:client-cf.dropbox.com:443
2017/06/01 20:10:19 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:10:19 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:11:21 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:11:21 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:11:21 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:11:21 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:11:21 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:11:21 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:11:21 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:11:21 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:11:21 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:11:33 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:11:33 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:11:33 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:12:44 [Info]Proxy|Socks: TCP Connect request to tcp:bolt.dropbox.com:443
2017/06/01 20:12:44 [Info]App|Dispatcher|Default: default route for tcp:bolt.dropbox.com:443
2017/06/01 20:12:44 [Info]App|Proxyman|Mux: dispatching request to tcp:bolt.dropbox.com:443
2017/06/01 20:12:57 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:12:57 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:12:57 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:13:18 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:13:18 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:13:18 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:13:29 [Info]App|Proxyman|Inbound: connection ends > Proxy|Socks: connection ends > Proxy|Socks: failed to transport all TCP request > read tcp 127.0.0.1:10086->127.0.0.1:1966: wsarecv: An existing connection was forcibly closed by the remote host.
2017/06/01 20:13:51 [Info]App|Proxyman|Inbound: connection ends > Proxy|Socks: connection ends > context canceled
2017/06/01 20:13:58 [Info]App|Proxyman|Inbound: connection ends > Proxy|Socks: connection ends > context canceled
2017/06/01 20:14:00 [Info]Proxy|Socks: TCP Connect request to tcp:block.dropbox.com:443
2017/06/01 20:14:00 [Info]App|Dispatcher|Default: default route for tcp:block.dropbox.com:443
2017/06/01 20:14:00 [Info]App|Proxyman|Mux: dispatching request to tcp:block.dropbox.com:443
2017/06/01 20:14:24 [Info]Proxy|Socks: TCP Connect request to tcp:bolt.dropbox.com:443
2017/06/01 20:14:24 [Info]App|Dispatcher|Default: default route for tcp:bolt.dropbox.com:443
2017/06/01 20:14:24 [Info]App|Proxyman|Mux: dispatching request to tcp:bolt.dropbox.com:443
2017/06/01 20:14:29 [Info]App|Proxyman|Inbound: connection ends > Proxy|Socks: connection ends > Proxy|Socks: failed to transport all TCP request > read tcp 127.0.0.1:10086->127.0.0.1:1968: wsarecv: An existing connection was forcibly closed by the remote host.
2017/06/01 20:15:21 [Info]App|Proxyman|Inbound: connection ends > Proxy|Socks: connection ends > context canceled
@qingfengshi
Copy link

我也发现这个问题,从使用kcp的第一天就有了,今天看完你的问题才知道是怎么回事

@ToutyRater
Copy link
Contributor

所谓的超速是因为v2ray按某个速率往外发送包,但电信对带宽的限制是电信的事,v2ray可突破不了,所以你看到上传速度很快,其实压根不是这么一回事。至于你说的文件上传不了的结果,我猜测是因为发送包太疯狂,电信把你的网给掐了,这个问题你可以试试开拥塞控制(我感觉没什么用)。耗流量是众所周知的

@lutasa43210
Copy link

我也遇到了相同的问题,临时解决方案在dropbox的首选项中限制上传的速度。

@nicholascw
Copy link
Contributor

如果说是只有dropbox客户端有这个问题,那个人觉得很可能是因为,你本地监测到的是发包的速率,但是上层网关到底给你drop多少你是无从得知的,如果Dropbox自己又有了自适应的发包策略应该会被本地错误的过大的发包量欺骗。。然后结果就是正向自激打环开始把发包量往高了推。。。然后就是运营商口中听不懂的话,什么QoS啊,黑洞路由啊……所以正解应该是再把dropbox的上传速率固定一下。至于网页版看到的数倍,同理,是kcp的正常工况

@DarienRaymond
Copy link
Contributor

mKCP 的带宽设定只是一个估算值,你可以尝试减少带宽设定以达到你需要的限额。

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

No branches or pull requests

6 participants