v2ray / v2ray-core

A platform for building proxies to bypass network restrictions.
https://www.v2ray.com/
MIT License
45.24k stars 8.93k forks source link

API HandlerServiceService.removeInbound cannot close established connetions #2219

Closed Tai7sy closed 4 years ago

Tai7sy commented 4 years ago

1) What version of V2Ray are you using (If you deploy different version on server and client, please explicitly point out)? v4.22.1

2) What's your scenario of using V2Ray? E.g., Watching YouTube videos in Chrome via Socks/VMess proxy.

Server: v2ray at v4.22.1, inbound protocol: shadowsocks Client: Shadowsocks-windows

3) What did you see? (Please describe in detail, such as timeout, fake TLS certificate etc)

when use api HandlerServiceService.removeInbound to remove a inbound dynamiclly, client can't esatblish new connection with server. but the established connections keep connected and alive.

4) What's your expectation?

the established connections based on this tag will be closed immediately.

5) Please attach your configuration file (Mask IP addresses before submit this issue).

Server configuration:

{
  "api": {
    "services": [
      "HandlerService", 
      "LoggerService", 
      "StatsService"
    ], 
    "tag": "api"
  }, 
  "stats": { }, 
  "policy": {
    "levels": {
      "0": {
        "handshake": 4,
        "connIdle": 120,
        "uplinkOnly":0,
        "downlinkOnly": 0,
        "statsUserUplink": true,
        "statsUserDownlink": true,
        "bufferSize": 4
      }
    },
    "system": {
      "statsInboundUplink": true,
      "statsInboundDownlink": true
    }
  }, 
  "log": {
    // "access": "access.log",
    // "error": "error.log",
    "loglevel": "debug"
  },
  "inbounds": [
    {
      "listen": "127.0.0.1", 
      "port": 23, 
      "protocol": "dokodemo-door", 
      "settings": {
        "address": "127.0.0.1"
      }, 
      "tag": "api"
    },
    {
      "protocol": "shadowsocks",
      "port": 10661,
      "settings": {
          "email": "v2@example.com",
          "method": "aes-128-cfb",
          "password": "123456",
          "level": 0,
          "ota": false,
          "network": "tcp"
      },
      "streamSettings": null
    }
  ],
  "outbounds": [
    {
      "protocol": "freedom",
      "settings": {}
    },
    {
      "protocol": "blackhole",
      "settings": {},
      "tag": "blocked"
    }
  ],
  "routing": {
    "domainStrategy": "AsIs",
    "rules": [
      {
        "type": "field",
        "inboundTag": ["api"], 
        "outboundTag": "api"
      }
    ]
  },
  "dns": null
}

Client configuration: use shadowsocks-windows

6) Please attach error logs, especially the bottom lines if the file is large. Error log file is usually at /var/log/v2ray/error.log on Linux.

Server error log:

HandlerServiceService.addInbound log:

2020/02/06 14:49:42 [Debug] v2ray.com/core/app/stats: create new counter inbound>>>port_443>>>traffic>>>uplink
2020/02/06 14:49:42 [Debug] v2ray.com/core/app/stats: create new counter inbound>>>port_443>>>traffic>>>downlink
2020/02/06 14:49:42 [Debug] v2ray.com/core/app/proxyman/inbound: creating stream worker on 0.0.0.0:443
2020/02/06 14:49:42 [Info] v2ray.com/core/transport/internet/tcp: listening TCP on 0.0.0.0:443

the api HandlerServiceService.removeInbound doesn't output any log (use netstat -nap and debug the v2ray-core, I can confirm the api request works and the inbound removed)

Client error log: none

7) Please attach access log. Access log is usually at '/var/log/v2ray/access.log' on Linux. none

8) Other configurations (such as Nginx) and logs. none

9) If V2Ray doesn't run, please attach output from --test. none

10) If V2Ray service doesn't run, please attach journal log. none

Tai7sy commented 4 years ago

1866

github-actions[bot] commented 4 years ago

This issue is stale because it has been open 120 days with no activity. Remove stale label or comment or this will be closed in 5 days