v2ray-core icon indicating copy to clipboard operation
v2ray-core copied to clipboard

LoggerService caused `panic: close of closed channel`.

Open mydogshitgold opened this issue 3 years ago • 0 comments

What version of V2Ray are you using?

V2Ray 5.2.1

What problems have you encountered?

Calling LoggerService (command v2ray api log) twice caused v2ray main process to panic with close of closed channel.

To reproduce the error, first start a v2ray instance with configuration provided bellow.

$ v2ray run -c config.yml

Then call LoggerService repeatedly

$ v2ray api log
^C
$ v2ray api log

Please attach your configuration here

api:
  tag: api
  services:
    - LoggerService

inbounds:
  - tag: api_in
    protocol: dokodemo-door
    listen: 127.0.0.1
    port: 8080
    settings:
      address: 127.0.0.1

routing:
  rules:
    - outboundTag: api
      inboundTag:
        - api_in
      type: field

If V2Ray service is abnormal, please attach journal log here

V2Ray 5.2.1 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.19.5 linux/amd64)
A unified platform for anti-censorship.
2023/01/27 10:59:17 [Info] transport/internet/tcp: listening TCP on 127.0.0.1:8080
2023/01/27 10:59:17 [Warning] V2Ray 5.2.1 started
2023/01/27 10:59:20 [Info] [858276990] proxy/dokodemo: received request for 127.0.0.1:45820
2023/01/27 10:59:20 [Info] [858276990] app/dispatcher: taking detour [api] for [tcp:127.0.0.1:0]
2023/01/27 10:59:20 127.0.0.1:45820 accepted tcp:127.0.0.1:0 [api]

panic: close of closed channel

goroutine 97 [running]:
github.com/v2fly/v2ray-core/v5/app/log/command.(*LoggerServer).FollowLog.func1({0x12e49a0?, 0xc000010a38?})
        github.com/v2fly/v2ray-core/v5/app/log/command/command.go:52 +0xa9
github.com/v2fly/v2ray-core/v5/app/log.(*Instance).Handle(0xc0000b3b80, {0x12e49a0?, 0xc000010a38?})
        github.com/v2fly/v2ray-core/v5/app/log/log.go:129 +0x129
github.com/v2fly/v2ray-core/v5/common/log.(*syncHandler).Handle(0xf79720?, {0x12e49a0?, 0xc000010a38?})
        github.com/v2fly/v2ray-core/v5/common/log/log.go:61 +0xad
github.com/v2fly/v2ray-core/v5/common/log.Record(...)
        github.com/v2fly/v2ray-core/v5/common/log/log.go:38
github.com/v2fly/v2ray-core/v5/common/errors.(*Error).WriteToLog(0xc000646240, {0xc000519e28, 0x1, 0x12dbe90?})
        github.com/v2fly/v2ray-core/v5/common/errors/errors.go:143 +0x1a6
github.com/v2fly/v2ray-core/v5/proxy/dokodemo.(*Door).Process(0xc000421780, {0x12f1340, 0xc00039a420}, 0x2, {0x7f8fc215ee40, 0xc000012028}, {0x12f1d88, 0xc00059c5b0})
        github.com/v2fly/v2ray-core/v5/proxy/dokodemo/dokodemo.go:128 +0x638
github.com/v2fly/v2ray-core/v5/app/proxyman/inbound.(*tcpWorker).callback(0xc0006979a0, {0x7f8fc215ee40, 0xc000012028})
        github.com/v2fly/v2ray-core/v5/app/proxyman/inbound/worker.go:100 +0x653
created by github.com/v2fly/v2ray-core/v5/app/proxyman/inbound.(*tcpWorker).Start.func1
        github.com/v2fly/v2ray-core/v5/app/proxyman/inbound/worker.go:116 +0x98

mydogshitgold avatar Jan 27 '23 03:01 mydogshitgold