[GH-ISSUE #2810] 游戏服务器过一段时间会掉出 #2245

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

Originally created by @swhoro on GitHub (Feb 19, 2022).
Original GitHub issue: https://github.com/fatedier/frp/issues/2810

Bug Description

在局域网内搭建valheim游戏服务器,腾讯云轻量应用服务器做frps,局域网内openwrt自带frpc
游戏内过一段时间通过公网连接的客户端会掉出,但之后可以正常连入;局域网内链接可以一直保持稳定。应该问题出在frp或公网服务器上

frpc Version

0.38.0

frps Version

0.39.1

System Architecture

linux/amd64

Configurations

frps:
[common]
bind_port = 7000
kcp_bind_port = 7000
token = xxxxxxxxxx

dashboard_port = 7500
dashboard_user = xxxxx
dashboard_pwd = xxxxx

frpc:
[common]
server_addr=xxx.xxx.xxx.xxx
server_port=7000
log_level=info
log_max_days=3
protocol=kcp
log_file=/var/etc/frp/frpc.log
admin_addr=0.0.0.0
admin_port=7400
admin_user=xxxxx
admin_pwd=xxxxx
tcp_mux=true
tls_enable=false
login_fail_exit=false

[valheim6]
type=udp
remote_port=2456
local_ip=192.168.1.7
local_port=2456
use_encryption=false
use_compression=true

[valheim7]
type=udp
remote_port=2457
local_ip=192.168.1.7
local_port=2457
use_encryption=false
use_compression=true

[valheim8]
type=udp
remote_port=2458
local_ip=192.168.1.7
local_port=2458
use_encryption=false
use_compression=true

Logs

断线期间frpc会有以下信息
2022/02/19 08:06:16 [E] [control.go:158] [0310c14a503d8542] work connection closed before response StartWorkConn message: EOF
2022/02/19 08:06:16 [E] [control.go:158] [0310c14a503d8542] work connection closed before response StartWorkConn message: EOF
2022/02/19 08:06:16 [I] [control.go:289] [0310c14a503d8542] control writer is closing
2022/02/19 08:06:16 [I] [service.go:174] [0310c14a503d8542] try to reconnect to server...
2022/02/19 08:06:16 [W] [proxy.go:516] [0310c14a503d8542] [valheim8] read from workConn for udp error: EOF
2022/02/19 08:06:16 [W] [proxy.go:516] [0310c14a503d8542] [valheim7] read from workConn for udp error: EOF
2022/02/19 08:06:16 [E] [control.go:158] [0310c14a503d8542] work connection closed before response StartWorkConn message: EOF
2022/02/19 08:06:16 [W] [proxy.go:516] [0310c14a503d8542] [valheim6] read from workConn for udp error: EOF
2022/02/19 08:06:16 [I] [proxy.go:530] [0310c14a503d8542] [valheim6] writer goroutine for udp work connection closed
2022/02/19 08:06:16 [I] [proxy.go:530] [0310c14a503d8542] [valheim7] writer goroutine for udp work connection closed
2022/02/19 08:06:16 [I] [proxy.go:530] [0310c14a503d8542] [valheim8] writer goroutine for udp work connection closed
2022/02/19 08:06:16 [I] [visitor_manager.go:60] [0310c14a503d8542] gracefully shutdown visitor manager

Steps to reproduce

...

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @swhoro on GitHub (Feb 19, 2022). Original GitHub issue: https://github.com/fatedier/frp/issues/2810 ### Bug Description 在局域网内搭建valheim游戏服务器,腾讯云轻量应用服务器做frps,局域网内openwrt自带frpc 游戏内过一段时间通过公网连接的客户端会掉出,但之后可以正常连入;局域网内链接可以一直保持稳定。应该问题出在frp或公网服务器上 ### frpc Version 0.38.0 ### frps Version 0.39.1 ### System Architecture linux/amd64 ### Configurations frps: [common] bind_port = 7000 kcp_bind_port = 7000 token = xxxxxxxxxx dashboard_port = 7500 dashboard_user = xxxxx dashboard_pwd = xxxxx frpc: [common] server_addr=xxx.xxx.xxx.xxx server_port=7000 log_level=info log_max_days=3 protocol=kcp log_file=/var/etc/frp/frpc.log admin_addr=0.0.0.0 admin_port=7400 admin_user=xxxxx admin_pwd=xxxxx tcp_mux=true tls_enable=false login_fail_exit=false [valheim6] type=udp remote_port=2456 local_ip=192.168.1.7 local_port=2456 use_encryption=false use_compression=true [valheim7] type=udp remote_port=2457 local_ip=192.168.1.7 local_port=2457 use_encryption=false use_compression=true [valheim8] type=udp remote_port=2458 local_ip=192.168.1.7 local_port=2458 use_encryption=false use_compression=true ### Logs 断线期间frpc会有以下信息 2022/02/19 08:06:16 [E] [control.go:158] [0310c14a503d8542] work connection closed before response StartWorkConn message: EOF 2022/02/19 08:06:16 [E] [control.go:158] [0310c14a503d8542] work connection closed before response StartWorkConn message: EOF 2022/02/19 08:06:16 [I] [control.go:289] [0310c14a503d8542] control writer is closing 2022/02/19 08:06:16 [I] [service.go:174] [0310c14a503d8542] try to reconnect to server... 2022/02/19 08:06:16 [W] [proxy.go:516] [0310c14a503d8542] [valheim8] read from workConn for udp error: EOF 2022/02/19 08:06:16 [W] [proxy.go:516] [0310c14a503d8542] [valheim7] read from workConn for udp error: EOF 2022/02/19 08:06:16 [E] [control.go:158] [0310c14a503d8542] work connection closed before response StartWorkConn message: EOF 2022/02/19 08:06:16 [W] [proxy.go:516] [0310c14a503d8542] [valheim6] read from workConn for udp error: EOF 2022/02/19 08:06:16 [I] [proxy.go:530] [0310c14a503d8542] [valheim6] writer goroutine for udp work connection closed 2022/02/19 08:06:16 [I] [proxy.go:530] [0310c14a503d8542] [valheim7] writer goroutine for udp work connection closed 2022/02/19 08:06:16 [I] [proxy.go:530] [0310c14a503d8542] [valheim8] writer goroutine for udp work connection closed 2022/02/19 08:06:16 [I] [visitor_manager.go:60] [0310c14a503d8542] gracefully shutdown visitor manager ### Steps to reproduce 1. 2. 3. ... ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [X] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
gitea-mirror 2026-05-05 13:26:47 -06:00
Author
Owner

@fatedier commented on GitHub (Feb 19, 2022):

可以看一下服务端有没有相关的错误日志

<!-- gh-comment-id:1045970899 --> @fatedier commented on GitHub (Feb 19, 2022): 可以看一下服务端有没有相关的错误日志
Author
Owner

@swhoro commented on GitHub (Feb 19, 2022):

可以看一下服务端有没有相关的错误日志

好像也是跟客户端类似的报错:
image
但是我不是很有把握这个是不是掉线时报错的
由于每次掉线间隔都有点长,我得先去收集一下信息

<!-- gh-comment-id:1045971599 --> @swhoro commented on GitHub (Feb 19, 2022): > 可以看一下服务端有没有相关的错误日志 好像也是跟客户端类似的报错: ![image](https://user-images.githubusercontent.com/34229589/154794076-4682d291-cd09-429e-ba9f-aa03cf972a1d.png) 但是我不是很有把握这个是不是掉线时报错的 由于每次掉线间隔都有点长,我得先去收集一下信息
Author
Owner

@fatedier commented on GitHub (Feb 19, 2022):

同样的信息可以过滤掉,主要是客户端和服务端断开连接中间的那些信息,看上去大概率还是网络问题。

<!-- gh-comment-id:1045971775 --> @fatedier commented on GitHub (Feb 19, 2022): 同样的信息可以过滤掉,主要是客户端和服务端断开连接中间的那些信息,看上去大概率还是网络问题。
Author
Owner

@swhoro commented on GitHub (Feb 19, 2022):

同样的信息可以过滤掉,主要是客户端和服务端断开连接中间的那些信息,看上去大概率还是网络问题。

刚说完就又掉线了一次...
应该可以确定这就是报错的信息
image

<!-- gh-comment-id:1045972229 --> @swhoro commented on GitHub (Feb 19, 2022): > 同样的信息可以过滤掉,主要是客户端和服务端断开连接中间的那些信息,看上去大概率还是网络问题。 刚说完就又掉线了一次... 应该可以确定这就是报错的信息 ![image](https://user-images.githubusercontent.com/34229589/154794244-a8d5e314-ba9c-4cb9-b8a5-ed9b207b9a19.png)
Author
Owner

@fatedier commented on GitHub (Feb 19, 2022):

log_level=debug ,这个在服务端设置一下,可以看到更多的信息。

<!-- gh-comment-id:1045974441 --> @fatedier commented on GitHub (Feb 19, 2022): `log_level=debug` ,这个在服务端设置一下,可以看到更多的信息。
Author
Owner

@swhoro commented on GitHub (Feb 19, 2022):

log_level=debug ,这个在服务端设置一下,可以看到更多的信息。

ok,我现在去试一下

<!-- gh-comment-id:1045974564 --> @swhoro commented on GitHub (Feb 19, 2022): > `log_level=debug` ,这个在服务端设置一下,可以看到更多的信息。 ok,我现在去试一下
Author
Owner

@swhoro commented on GitHub (Feb 19, 2022):

log_level=debug ,这个在服务端设置一下,可以看到更多的信息。

image
掉线了

<!-- gh-comment-id:1045979006 --> @swhoro commented on GitHub (Feb 19, 2022): > `log_level=debug` ,这个在服务端设置一下,可以看到更多的信息。 ![image](https://user-images.githubusercontent.com/34229589/154795695-eba45640-c1d6-4cdd-8823-7d28a9a5f3c6.png) 掉线了
Author
Owner

@fatedier commented on GitHub (Feb 21, 2022):

protocol=tcp
tls_enable=true

换成这样试试,看上去还是网络中断,具体的原因可能有很多,尽量用 TCP 开启 TLS 可能会受干扰少一些。

<!-- gh-comment-id:1046430418 --> @fatedier commented on GitHub (Feb 21, 2022): ``` protocol=tcp tls_enable=true ``` 换成这样试试,看上去还是网络中断,具体的原因可能有很多,尽量用 TCP 开启 TLS 可能会受干扰少一些。
Author
Owner

@swhoro commented on GitHub (Feb 21, 2022):

protocol=tcp
tls_enable=true

换成这样试试,看上去还是网络中断,具体的原因可能有很多,尽量用 TCP 开启 TLS 可能会受干扰少一些。

好的,我去试试
一开始其实我使用的tcp,但是没开tls,好像也会掉线
意思是我家的运营商可能每过一段时间就干扰udp传输?
还有一堆问题...
1.tls貌似需要证书?我看文档里面还需要ca root证书?我的服务器有digicert签的证书,但是ca root不知道咋搞。以及我客户端直接打开tls,不配置证书貌似也没报错,不清楚tls有没有成功。
2.kcp协议可以用tls吗
3.use_encryption这一项需要打开吗?
4.我家做了单线多拨,拨号设备上有四个不同的内网ip。查询自己的公网ip的时候有时候会有两个不同的公网ip来回切换,这样会有影响吗

<!-- gh-comment-id:1046480514 --> @swhoro commented on GitHub (Feb 21, 2022): > ``` > protocol=tcp > tls_enable=true > ``` > > 换成这样试试,看上去还是网络中断,具体的原因可能有很多,尽量用 TCP 开启 TLS 可能会受干扰少一些。 好的,我去试试 一开始其实我使用的tcp,但是没开tls,好像也会掉线 意思是我家的运营商可能每过一段时间就干扰udp传输? 还有一堆问题... 1.tls貌似需要证书?我看文档里面还需要ca root证书?我的服务器有digicert签的证书,但是ca root不知道咋搞。以及我客户端直接打开tls,不配置证书貌似也没报错,不清楚tls有没有成功。 2.kcp协议可以用tls吗 3.use_encryption这一项需要打开吗? 4.我家做了单线多拨,拨号设备上有四个不同的内网ip。查询自己的公网ip的时候有时候会有两个不同的公网ip来回切换,这样会有影响吗
Author
Owner

@Becods commented on GitHub (Feb 28, 2022):

我家做了单线多拨

考虑一下是否为多拨的原因
如果可以的话尽量不要使用多拨,这样容易在切换负载的时候因为ip不同而引发掉线

<!-- gh-comment-id:1054075246 --> @Becods commented on GitHub (Feb 28, 2022): > 我家做了单线多拨 考虑一下是否为多拨的原因 如果可以的话尽量不要使用多拨,这样容易在切换负载的时候因为ip不同而引发掉线
Author
Owner

@github-actions[bot] commented on GitHub (Mar 31, 2022):

Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.

<!-- gh-comment-id:1083986331 --> @github-actions[bot] commented on GitHub (Mar 31, 2022): Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
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#2245
No description provided.