[GH-ISSUE #3837] frpc被杀死不会触发服务端CloseProxy事件 #3049

Closed
opened 2026-05-05 13:58:26 -06:00 by gitea-mirror · 6 comments
Owner

Originally created by @ARTI5T on GitHub (Dec 9, 2023).
Original GitHub issue: https://github.com/fatedier/frp/issues/3837

Bug Description

frpc被SIGKILL杀死断开连接后,服务端不会向插件发送CloseProxy事件。

frpc Version

0.52.3

frps Version

0.52.3

System Architecture

linux/amd64

Configurations

bindPort = {{ .Envs.FRPS_BIND_PORT }}
kcpBindPort = {{ .Envs.FRPS_KCP_BIND_PORT }}
quicBindPort = {{ .Envs.FRPS_QUIC_BIND_PORT }}
allowPorts = [
    { start = 10000, end = 19999 }
]

auth.token = "{{ .Envs.FRPS_AUTH_TOKEN }}"

[[httpPlugins]]
name = "register"
addr = "localhost:8080"
path = "/register"
ops = ["NewProxy"]

[[httpPlugins]]
name = "unregister"
addr = "localhost:8080"
path = "/unregister"
ops = ["CloseProxy"]

[[httpPlugins]]
name = "login"
addr = "localhost:8080"
path = "/login"
ops = ["Login"]

Logs

frpc正常退出会在frps看到如下log:

[control.go:512] close proxy [xxxx] success

frpc被SIGKILL则不会看到这条log

Steps to reproduce

No response

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @ARTI5T on GitHub (Dec 9, 2023). Original GitHub issue: https://github.com/fatedier/frp/issues/3837 ### Bug Description frpc被SIGKILL杀死断开连接后,服务端不会向插件发送CloseProxy事件。 ### frpc Version 0.52.3 ### frps Version 0.52.3 ### System Architecture linux/amd64 ### Configurations ``` bindPort = {{ .Envs.FRPS_BIND_PORT }} kcpBindPort = {{ .Envs.FRPS_KCP_BIND_PORT }} quicBindPort = {{ .Envs.FRPS_QUIC_BIND_PORT }} allowPorts = [ { start = 10000, end = 19999 } ] auth.token = "{{ .Envs.FRPS_AUTH_TOKEN }}" [[httpPlugins]] name = "register" addr = "localhost:8080" path = "/register" ops = ["NewProxy"] [[httpPlugins]] name = "unregister" addr = "localhost:8080" path = "/unregister" ops = ["CloseProxy"] [[httpPlugins]] name = "login" addr = "localhost:8080" path = "/login" ops = ["Login"] ``` ### Logs frpc正常退出会在frps看到如下log: ``` [control.go:512] close proxy [xxxx] success ``` frpc被SIGKILL则不会看到这条log ### Steps to reproduce _No response_ ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [X] Server Plugin - [ ] Extensions - [ ] Others
Author
Owner

@superzjg commented on GitHub (Dec 9, 2023):

要等待一段时间,frps才会知晓并关闭,在等待的一段时间内再次联机连不上。
所以,写脚本时,尽量先用常规的15信号杀一次,再用 9 (SIGKILL)杀一次即可。本来SIGKILL就是不推荐第一次使用,它不会让应用程序任何善后的动作。

<!-- gh-comment-id:1848373927 --> @superzjg commented on GitHub (Dec 9, 2023): 要等待一段时间,frps才会知晓并关闭,在等待的一段时间内再次联机连不上。 所以,写脚本时,尽量先用常规的15信号杀一次,再用 9 (SIGKILL)杀一次即可。本来SIGKILL就是不推荐第一次使用,它不会让应用程序任何善后的动作。
Author
Owner

@ARTI5T commented on GitHub (Dec 9, 2023):

服务端在发现客户端掉线后都应当触发CloseProxy事件,无论客户端是正常退出还是handshake超时掉线。但是似乎存在客户端超时不会触发该事件的bug。

<!-- gh-comment-id:1848397464 --> @ARTI5T commented on GitHub (Dec 9, 2023): 服务端在发现客户端掉线后都应当触发CloseProxy事件,无论客户端是正常退出还是handshake超时掉线。但是似乎存在客户端超时不会触发该事件的bug。
Author
Owner

@superzjg commented on GitHub (Dec 9, 2023):

服务端在发现客户端掉线后都应当触发CloseProxy事件,无论客户端是正常退出还是handshake超时掉线。现在的bug是客户端超时不会触发该事件。

超时是会触发的,我测试了,不过要最长至几十秒时间,时间一到,frps会输出相关日志。在此段时间内影响同一个frpc代理重启再次连接时连不上。

<!-- gh-comment-id:1848401353 --> @superzjg commented on GitHub (Dec 9, 2023): > 服务端在发现客户端掉线后都应当触发CloseProxy事件,无论客户端是正常退出还是handshake超时掉线。现在的bug是客户端超时不会触发该事件。 超时是会触发的,我测试了,不过要最长至几十秒时间,时间一到,frps会输出相关日志。在此段时间内影响同一个frpc代理重启再次连接时连不上。
Author
Owner

@superzjg commented on GitHub (Dec 9, 2023):

我测试的时候,将 transport.heartbeatInterval 设为负数,禁用了心跳,默认的tcpmux检查时间是60秒。若不禁用心跳,应该是默认30秒,等待时间更短。

<!-- gh-comment-id:1848403468 --> @superzjg commented on GitHub (Dec 9, 2023): 我测试的时候,将 `transport.heartbeatInterval` 设为负数,禁用了心跳,默认的tcpmux检查时间是60秒。若不禁用心跳,应该是默认30秒,等待时间更短。
Author
Owner

@xqzr commented on GitHub (Dec 9, 2023):

应该是默认30秒

e66e77cb8f/conf/frpc_full_example.toml (L117)

<!-- gh-comment-id:1848404609 --> @xqzr commented on GitHub (Dec 9, 2023): > 应该是默认30秒 https://github.com/fatedier/frp/blob/e66e77cb8f596e9cc76552a46f1918e2c17afea0/conf/frpc_full_example.toml#L117
Author
Owner

@ARTI5T commented on GitHub (Dec 9, 2023):

已确认,默认timeout比较长,修改timeout之后可以使用了。

<!-- gh-comment-id:1848575916 --> @ARTI5T commented on GitHub (Dec 9, 2023): 已确认,默认timeout比较长,修改timeout之后可以使用了。
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#3049
No description provided.