fatedier / frp

A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet.
Apache License 2.0
85.67k stars 13.27k forks source link

游戏服务器过一段时间会掉出 #2810

Closed swhoro closed 2 years ago

swhoro commented 2 years ago

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. ...

Affected area

fatedier commented 2 years ago

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

swhoro commented 2 years ago

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

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

fatedier commented 2 years ago

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

swhoro commented 2 years ago

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

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

fatedier commented 2 years ago

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

swhoro commented 2 years ago

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

ok,我现在去试一下

swhoro commented 2 years ago

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

image 掉线了

fatedier commented 2 years ago
protocol=tcp
tls_enable=true

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

swhoro commented 2 years ago
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来回切换,这样会有影响吗

Becods commented 2 years ago

我家做了单线多拨

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

github-actions[bot] commented 2 years ago

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