Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve WebDAV/S3 data sync request timeout settings #12734

Closed
3 tasks done
FreeBoy-V-V opened this issue Oct 8, 2024 · 1 comment
Closed
3 tasks done

Improve WebDAV/S3 data sync request timeout settings #12734

FreeBoy-V-V opened this issue Oct 8, 2024 · 1 comment
Assignees
Milestone

Comments

@FreeBoy-V-V
Copy link

FreeBoy-V-V commented Oct 8, 2024

使用IPV6的DNS解析慢导致云端同步失败

Is there an existing issue for this?

  • I have searched the existing issues

Can the issue be reproduced with the default theme (daylight/midnight)?

  • I was able to reproduce the issue with the default theme

Could the issue be due to extensions?

  • I've ruled out the possibility that the extension is causing the problem.

Describe the problem

1、在“设置”->“云端”配置页面,将“云端存储服务提供商”设置为S3,将“Endpoint”设置为内网IPv4地址,“Timeout (s)”配置为30s,在设置“云端同步目录”时,可以在1秒内获取到存储目录并配置,手工点击“同步”时,可以正常同步。
2、流程同上,其他配置不变,将“Endpoint”设置为IPv6地址对应的DNS域名,可以在30秒内获取到存储目录并配置,手工点击“同步”时,提示“云端存储服务提供商网络连通性校验异常,请检查网络配置 (Provider: S3) v3.1.8”。
3、查看日志,见日志文件,错误位置是:kernel\util\net.go 136行,错误信息是:context deadline exceeded
4、通过错误查找,需要优化的是:kernel\util\net.go 108行,c := req.C().SetTimeout(3 * time.Second),默认的超时时间只有3秒,导致IPv6的DNS域名无法解析完成。

Expected result

kernel\util\net.go的isOnline方法检测云端存储服务是否在线时,使用配置的“Timeout (s)”时间或默认30s,可以正常同步数据。

Screenshot or screen recording presentation

No response

Version environment

- Version: 3.1.8
- Operating System: Windows 11, Microsoft Windows [版本 10.0.22631.4037]
- Browser (if used):

Log file

W 2024/10/08 14:54:08 net.go:136: check url [https://x.x.x:1234/] is online failed: Get "https://x.x.x:1234/": context deadline exceeded
W 2024/10/08 14:54:12 net.go:136: check url [https://x.x.x:1234/] is online failed: Get "https://x.x.x:1234/": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
W 2024/10/08 14:54:12 net.go:90: network is offline [checkURL=https://x.x.x:1234/]

More information

kernel\util\net.go的isOnline方法如下:

func isOnline(checkURL string, skipTlsVerify bool) (ret bool) {
	c := req.C().SetTimeout(3 * time.Second)
	if skipTlsVerify {
		c.EnableInsecureSkipVerify()
	}
	c.SetUserAgent(UserAgent)

	for i := 0; i < 2; i++ {
		resp, err := c.R().Get(checkURL)

		if resp.GetHeader("Location") != "" {
			return true
		}

		switch err.(type) {
		case *url.Error:
			if err.(*url.Error).URL != checkURL {
				// DNS 重定向
				logging.LogWarnf("network is online [DNS redirect, checkURL=%s, retURL=%s]", checkURL, err.(*url.Error).URL)
				return true
			}
		}

		ret = err == nil
		if ret {
			break
		}

		time.Sleep(1 * time.Second)
		logging.LogWarnf("check url [%s] is online failed: %s", checkURL, err)
	}
	return
}
@88250 88250 self-assigned this Oct 8, 2024
@88250 88250 added this to the 3.1.9 milestone Oct 8, 2024
@88250 88250 changed the title 使用IPV6的DNS解析慢导致云端同步失败 Improve WebDAV/S3 data sync request timeout settings Oct 8, 2024
@88250 88250 closed this as completed Oct 8, 2024
@Topikc1
Copy link

Topikc1 commented Oct 10, 2024

Yess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants