[GH-ISSUE #4959] vhost http 在间隔5秒请求时会出现EOF错误 #3908

Closed
opened 2026-05-05 14:29:35 -06:00 by gitea-mirror · 3 comments
Owner

Originally created by @dicarne on GitHub (Aug 27, 2025).
Original GitHub issue: https://github.com/fatedier/frp/issues/4959

Bug Description

在使用子域名访问网站时,每隔5秒持续请求有时会出现EOF错误:

2025-08-27 11:51:07.231 [W] [httputil/reverseproxy.go:486] do http proxy request [host: test.my.local] error: EOF

之所以要强调5秒,是因为当间隔为1、2、3、4、6、7、8、9、10秒时,都能正确响应,并且100%正确;
但间隔为5秒循环请求时,有大约40%的请求会出现错误。(经测试,极限范围在4.95秒-5.05秒左右)

测试环境中,没有NGINX没有防火墙,frpc和frps均在同一台机器(经测试不同机器也有这个问题),并且保证被代理的web服务无论怎么请求都是正确返回的。
测试用的frps和frpc均为github release最新版。

尝试调整transport相关的参数但并没有任何影响。

有没有相关的思路,通过配置避免这个问题?5秒整的间隔看起来很有可能是某种内部配置导致的。

frpc Version

v0.64.0

frps Version

v0.64.0

System Architecture

windows/amd64

Configurations

frps.toml

bindPort = 7000
vhostHTTPPort = 8780
subdomainHost = "my.local"

frpc.toml

serverAddr = "127.0.0.1"
serverPort = 7000

[[proxies]]
name = "web"
type = "http"
localPort = 57250
subdomain = "test"

测试脚本

import requests
import time

while True:
    r = requests.post("http://127.0.0.1:8780/hi", headers={
        "Host": "test.my.local"
    })
    print(r.text)
    time.sleep(5)

Logs

frps

2025-08-27 11:50:42.007 [I] [frps/root.go:108] frps uses config file: .\frps.toml
2025-08-27 11:50:42.133 [I] [server/service.go:237] frps tcp listen on 0.0.0.0:7000
2025-08-27 11:50:42.133 [I] [server/service.go:305] http service listen on 0.0.0.0:8780
2025-08-27 11:50:42.133 [I] [frps/root.go:117] frps started successfully
2025-08-27 11:50:45.229 [I] [server/service.go:582] [908dd5204564d7cb] client login info: ip [127.0.0.1:30029] version [0.64.0] hostname [] os [windows] arch [amd64]
2025-08-27 11:50:45.230 [I] [proxy/http.go:144] [908dd5204564d7cb] [web] http proxy listen for host [test.my.local] location [] group [], routeByHTTPUser []
2025-08-27 11:50:45.230 [I] [server/control.go:399] [908dd5204564d7cb] new proxy [web] type [http] success
2025-08-27 11:51:07.231 [W] [httputil/reverseproxy.go:486] do http proxy request [host: test.my.local] error: EOF
2025-08-27 11:51:17.238 [W] [httputil/reverseproxy.go:486] do http proxy request [host: test.my.local] error: EOF

frpc

2025-08-27 11:50:45.206 [I] [sub/root.go:149] start frpc service for config file [.\frpc.toml]
2025-08-27 11:50:45.225 [I] [client/service.go:319] try to connect to server...
2025-08-27 11:50:45.229 [I] [client/service.go:311] [908dd5204564d7cb] login to server success, get run id [908dd5204564d7cb]
2025-08-27 11:50:45.229 [I] [proxy/proxy_manager.go:177] [908dd5204564d7cb] proxy added: [web]
2025-08-27 11:50:45.230 [I] [client/control.go:172] [908dd5204564d7cb] [web] start proxy success

测试结果

{"code":200,"msg":"hi","data":null}
<!DOCTYPE html>
<html>
<head>
<title>Not Found</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>The page you requested was not found.</h1>
<p>Sorry, the page you are looking for is currently unavailable.<br/>
Please try again later.</p>
<p>The server is powered by <a href="https://github.com/fatedier/frp">frp</a>.</p>
<p><em>Faithfully yours, frp.</em></p>
</body>
</html>

{"code":200,"msg":"hi","data":null}
<!DOCTYPE html>
<html>
<head>
<title>Not Found</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>The page you requested was not found.</h1>
<p>Sorry, the page you are looking for is currently unavailable.<br/>
Please try again later.</p>
<p>The server is powered by <a href="https://github.com/fatedier/frp">frp</a>.</p>
<p><em>Faithfully yours, frp.</em></p>
</body>
</html>

其中,{"code":200,"msg":"hi","data":null}是正确的结果。

Steps to reproduce

  1. 在57250端口准备一个测试用的web服务接口,并且保证请求不会有任何问题
  2. 根据配置文件启动frps和frpc
  3. 启动测试脚本,每隔5秒带上host请求8780端口
  4. 观察日志,可以看到请求有较大概率失败

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @dicarne on GitHub (Aug 27, 2025). Original GitHub issue: https://github.com/fatedier/frp/issues/4959 ### Bug Description 在使用子域名访问网站时,每隔5秒持续请求有时会出现EOF错误: ``` 2025-08-27 11:51:07.231 [W] [httputil/reverseproxy.go:486] do http proxy request [host: test.my.local] error: EOF ``` 之所以要强调5秒,是因为当间隔为1、2、3、4、6、7、8、9、10秒时,都能正确响应,并且100%正确; 但间隔为5秒循环请求时,有大约40%的请求会出现错误。(经测试,极限范围在4.95秒-5.05秒左右) 测试环境中,**没有NGINX**,**没有防火墙**,frpc和frps均在同一台机器(经测试不同机器也有这个问题),并且保证**被代理的web服务无论怎么请求都是正确返回**的。 测试用的frps和frpc均为github release最新版。 尝试调整transport相关的参数但并没有任何影响。 有没有相关的思路,通过配置避免这个问题?5秒整的间隔看起来很有可能是某种内部配置导致的。 ### frpc Version v0.64.0 ### frps Version v0.64.0 ### System Architecture windows/amd64 ### Configurations `frps.toml` ```toml bindPort = 7000 vhostHTTPPort = 8780 subdomainHost = "my.local" ``` `frpc.toml` ```toml serverAddr = "127.0.0.1" serverPort = 7000 [[proxies]] name = "web" type = "http" localPort = 57250 subdomain = "test" ``` 测试脚本 ```python import requests import time while True: r = requests.post("http://127.0.0.1:8780/hi", headers={ "Host": "test.my.local" }) print(r.text) time.sleep(5) ``` ### Logs `frps` ``` 2025-08-27 11:50:42.007 [I] [frps/root.go:108] frps uses config file: .\frps.toml 2025-08-27 11:50:42.133 [I] [server/service.go:237] frps tcp listen on 0.0.0.0:7000 2025-08-27 11:50:42.133 [I] [server/service.go:305] http service listen on 0.0.0.0:8780 2025-08-27 11:50:42.133 [I] [frps/root.go:117] frps started successfully 2025-08-27 11:50:45.229 [I] [server/service.go:582] [908dd5204564d7cb] client login info: ip [127.0.0.1:30029] version [0.64.0] hostname [] os [windows] arch [amd64] 2025-08-27 11:50:45.230 [I] [proxy/http.go:144] [908dd5204564d7cb] [web] http proxy listen for host [test.my.local] location [] group [], routeByHTTPUser [] 2025-08-27 11:50:45.230 [I] [server/control.go:399] [908dd5204564d7cb] new proxy [web] type [http] success 2025-08-27 11:51:07.231 [W] [httputil/reverseproxy.go:486] do http proxy request [host: test.my.local] error: EOF 2025-08-27 11:51:17.238 [W] [httputil/reverseproxy.go:486] do http proxy request [host: test.my.local] error: EOF ``` `frpc` ``` 2025-08-27 11:50:45.206 [I] [sub/root.go:149] start frpc service for config file [.\frpc.toml] 2025-08-27 11:50:45.225 [I] [client/service.go:319] try to connect to server... 2025-08-27 11:50:45.229 [I] [client/service.go:311] [908dd5204564d7cb] login to server success, get run id [908dd5204564d7cb] 2025-08-27 11:50:45.229 [I] [proxy/proxy_manager.go:177] [908dd5204564d7cb] proxy added: [web] 2025-08-27 11:50:45.230 [I] [client/control.go:172] [908dd5204564d7cb] [web] start proxy success ``` 测试结果 ``` {"code":200,"msg":"hi","data":null} <!DOCTYPE html> <html> <head> <title>Not Found</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>The page you requested was not found.</h1> <p>Sorry, the page you are looking for is currently unavailable.<br/> Please try again later.</p> <p>The server is powered by <a href="https://github.com/fatedier/frp">frp</a>.</p> <p><em>Faithfully yours, frp.</em></p> </body> </html> {"code":200,"msg":"hi","data":null} <!DOCTYPE html> <html> <head> <title>Not Found</title> <style> body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } </style> </head> <body> <h1>The page you requested was not found.</h1> <p>Sorry, the page you are looking for is currently unavailable.<br/> Please try again later.</p> <p>The server is powered by <a href="https://github.com/fatedier/frp">frp</a>.</p> <p><em>Faithfully yours, frp.</em></p> </body> </html> ``` 其中,`{"code":200,"msg":"hi","data":null}`是正确的结果。 ### Steps to reproduce 1. 在57250端口准备一个测试用的web服务接口,并且保证请求不会有任何问题 2. 根据配置文件启动frps和frpc 3. 启动测试脚本,每隔5秒带上host请求8780端口 4. 观察日志,可以看到请求有较大概率失败 ### Affected area - [ ] Docs - [ ] Installation - [x] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
gitea-mirror 2026-05-05 14:29:35 -06:00
Author
Owner

@dicarne commented on GitHub (Aug 27, 2025):

可能与 https://github.com/golang/go/issues/53472#issuecomment-2852798385 有关。

添加下面这个选项后,可以解决此问题。但感觉不是最优选择……

Image
<!-- gh-comment-id:3226881948 --> @dicarne commented on GitHub (Aug 27, 2025): 可能与 https://github.com/golang/go/issues/53472#issuecomment-2852798385 有关。 添加下面这个选项后,可以解决此问题。但感觉不是最优选择…… <img width="898" height="656" alt="Image" src="https://github.com/user-attachments/assets/6a4c3b6a-6c45-4d62-bd4b-e711b92447ca" />
Author
Owner

@dicarne commented on GitHub (Aug 28, 2025):

或者idleCoonTimeout调整到4秒也可以避免这个问题,推测是frpc客户端5秒会主动关闭连接,但frps服务端可能在同时发生请求。最好的办法就是提高frpc客户端主动关闭连接的时间。不太清楚如何配置,调整了几个看似相关的配置项但都没有效果。

Image
<!-- gh-comment-id:3230431129 --> @dicarne commented on GitHub (Aug 28, 2025): 或者idleCoonTimeout调整到4秒也可以避免这个问题,推测是frpc客户端5秒会主动关闭连接,但frps服务端可能在同时发生请求。最好的办法就是提高frpc客户端主动关闭连接的时间。不太清楚如何配置,调整了几个看似相关的配置项但都没有效果。 <img width="602" height="168" alt="Image" src="https://github.com/user-attachments/assets/68bac9b0-45e9-488b-b92b-69781a79482c" />
Author
Owner

@github-actions[bot] commented on GitHub (Sep 11, 2025):

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

<!-- gh-comment-id:3276981233 --> @github-actions[bot] commented on GitHub (Sep 11, 2025): Issues go stale after 14d of inactivity. Stale issues rot after an additional 3d 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#3908
No description provided.