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

上传附件或者主题报错,超过30秒 #3041

Closed
kingname opened this issue Dec 25, 2022 · 20 comments · Fixed by halo-dev/console#813
Closed

上传附件或者主题报错,超过30秒 #3041

kingname opened this issue Dec 25, 2022 · 20 comments · Fixed by halo-dev/console#813
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/improvement Categorizes issue or PR as related to a improvement. triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@kingname
Copy link

是什么版本出现了此问题?

2.0.2

使用的什么数据库?

MariaDB

使用的哪种方式部署?

Docker

在线站点地址

No response

发生了什么?

image

无论是上传附件还是上传主题,都会报图中所示的错误。

相关日志输出

No response

附加信息

image

@ruibaby
Copy link
Member

ruibaby commented Dec 25, 2022

是否如提示一样等待了 30 s 呢?建议先看看浏览器控制台的异常。

可能和这个配置有关:https://uppy.io/docs/xhr-upload/#timeout-30-1000

/triage needs-information

@f2c-ci-robot f2c-ci-robot bot added the triage/needs-information Indicates an issue needs more information in order to work on it. label Dec 25, 2022
@kingname
Copy link
Author

kingname commented Dec 25, 2022 via email

@kingname
Copy link
Author

是否如提示一样等待了 30 s 呢?建议先看看浏览器控制台的异常。

可能和这个配置有关:https://uppy.io/docs/xhr-upload/#timeout-30-1000

/triage needs-information

是的,就是这个报错。请问我在哪里可以设置延长这个超时时间呢?

@ruibaby
Copy link
Member

ruibaby commented Dec 26, 2022

@kingname 先看浏览器控制台的异常和后端的日志才能排查,这并不一定是上传超时了。

@kingname
Copy link
Author

@ruibaby 在控制台看了,就是[uppy]报的30秒超时

@ruibaby
Copy link
Member

ruibaby commented Dec 26, 2022

可以截下图,顺便看看 Network 是否有发起上传请求。

@kingname
Copy link
Author

image

image

@ruibaby
Copy link
Member

ruibaby commented Dec 27, 2022

上传附件会有这个问题吗?

@kingname
Copy link
Author

kingname commented Jan 1, 2023

不再使用halo,本issue关闭。

@kingname kingname closed this as completed Jan 1, 2023
@ruibaby
Copy link
Member

ruibaby commented Jan 2, 2023

此问题目前还没有得到原因和复现,建议保持打开的状态,以便后续使用者继续反馈的跟踪。

感谢 @kingname 的反馈。

/reopen

@f2c-ci-robot f2c-ci-robot bot reopened this Jan 2, 2023
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Jan 2, 2023

@ruibaby: Reopened this issue.

In response to this:

此问题目前还没有得到原因和复现,建议保持打开的状态,以便后续使用者继续反馈的跟踪,感谢 @kingname 的反馈。

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@JohnNiang
Copy link
Member

我这边也未复现。复现步骤:通过 Good 3G 的网络限流上传 3.1MB 大小的主题,可参考以下截图:

image

@kingname
Copy link
Author

kingname commented Jan 3, 2023

我这里的环境是这样的:

  1. 在群晖上面通过Docker搭建Halo
  2. 在一台东京的云服务器上面,搭建frp,转发到群晖上
  3. 通过nginx创建反向代理到frp对应的端口
  4. cloudflare域名解析到云服务器的443端口

@JohnNiang
Copy link
Member

我这里的环境是这样的:

1. 在群晖上面通过Docker搭建Halo

2. 在一台东京的云服务器上面,搭建frp,转发到群晖上

3. 通过nginx创建反向代理到frp对应的端口

4. cloudflare域名解析到云服务器的443端口

建议先通过群晖访问 Halo 安装主题或者插件,看看是否会出现同样的错误。如果没有出现该错误,确认一下反向代理配置是否正确。

我刚刚又在本地通过 Docker 运行测试,仍然没有遇到 30s 超时的问题,测试命令如下:

docker run \
  -it -d \
  --name halo \
  -p 8090:8090 \
  -v ~/.halo2:/root/.halo2 \
  halohub/halo:2.0.2 \
  --halo.external-url=http://localhost:8090/ \
  --halo.security.initializer.superadminuser=admin \
  --halo.security.initializer.superadminpassword=P@88w0rd

测试结果如下:

image

@longjuan
Copy link
Member

longjuan commented Jan 3, 2023

halo-sigs/plugin-alioss#13
这边也有个上传超时的issues,不过是在附件上传的时候的,uppy中的上传超时时间可以考虑是否应该调整


我也遇到过安装插件时发生超时错误
具体是在halo刚启动没多久的时候(cpu占用还比较高)
同时我这台测试服务器配置比较低,是azure香港1核1G

@ruibaby
Copy link
Member

ruibaby commented Jan 3, 2023

@longjuan 但 uppy 的文档说的是请求没有进度才会 timeout,所以怀疑还是因为请求还没有到达服务器,比如由于 Nginx 的大小限制。

我将研究一下如何触发 uppy 的这个异常。

@kingname
Copy link
Author

kingname commented Jan 3, 2023

直接在群晖上面使用IP访问的时候,可以正常上传。只有在用域名通过云服务器+nginx+frp转发的时候,才报错。

nginx已经设置过post请求体的大小和超时时间了。用域名访问的时候,除了上传文件,其他功能都是正常的。

@longjuan
Copy link
Member

longjuan commented Jan 3, 2023

@ruibaby 可以使用https://github.com/longjuan/halo-plugin-s3os/actions/runs/3829474290 这里的jar包,我通过Thread.sleep模拟上传文件到对象存储过慢
image
image

@ruibaby
Copy link
Member

ruibaby commented Jan 3, 2023

已经明白了导致这个问题的原因。是因为上传附件或者安装主题插件时,即便文件已经向服务器发送完毕,后端也会继续处理后续的逻辑,如果这个时间超过 uppy 组件设置的 timeout 时间,就会抛出异常(uppy 会检测是否有进度,请参考 https://github.com/transloadit/uppy/blob/83ac000c31bb8bcb806a22ef6a9e06f041e47d8a/packages/%40uppy/xhr-upload/src/index.js#L232-L259)

文件发送到服务器完毕之后会是 100%,这里的 100% 并不代表是服务端已经处理完毕,而是文件发送完毕。

image

题主的情况应该是上传到服务器之后还要经过 frp,可能是这个阶段的时间造成了这个问题。

可以在 uppy 取消这个 timeout 设置。

@longjuan 提供的测试方式非常容易复现,感谢。

@ruibaby ruibaby added good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/improvement Categorizes issue or PR as related to a improvement. labels Jan 3, 2023
@longjuan
Copy link
Member

longjuan commented Jan 6, 2023

/assign

f2c-ci-robot bot pushed a commit to halo-dev/console that referenced this issue Jan 6, 2023
…ds (#813)

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. 如果这是你的第一次,请阅读我们的贡献指南:<https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>。
1. If this is your first time, please read our contributor guidelines: <https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>.
2. 请根据你解决问题的类型为 Pull Request 添加合适的标签。
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request.
3. 请确保你已经添加并运行了适当的测试。
3. Ensure you have added or ran the appropriate tests for your PR.
-->

#### What type of PR is this?

<!--
添加其中一个类别:
Add one of the following kinds:
/kind bug
/kind cleanup
/kind documentation
/kind feature
/kind optimization
适当添加其中一个或多个类别(可选):
Optionally add one or more of the following kinds if applicable:
/kind api-change
/kind deprecation
/kind failing-test
/kind flake
/kind regression
-->
/kind improvement
#### What this PR does / why we need it:
Remove the timeout error prompt caused by the upload server processing for more than 30 seconds
#### Which issue(s) this PR fixes:

<!--
PR 合并时自动关闭 issue。
Automatically closes linked issue when PR is merged.
用法:`Fixes #<issue 号>`,或者 `Fixes (粘贴 issue 完整链接)`
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Fixes halo-dev/halo#3041
#### Screenshots:

<!--
如果此 PR 有 UI 的改动,最好截图说明这个 PR 的改动。
If there are UI changes to this PR, it is best to take a screenshot to illustrate the changes to this PR.
eg.
Before:
![screenshot-before](https://user-images.githubusercontent.com/screenshot.png)
After:
![screenshot-after](https://user-images.githubusercontent.com/screenshot.png)
-->
![image](https://user-images.githubusercontent.com/28662535/210917239-b4b050f8-766f-4289-9ba2-ccb99bb6ac55.png)
![image](https://user-images.githubusercontent.com/28662535/210917273-c6291485-f420-4f02-a7c8-2b4b286110d4.png)


#### Special notes for your reviewer:
测试:
上传大文件让后端处理过程超过30秒,观察是否报错
或使用[修改后的插件](https://github.com/longjuan/halo-plugin-s3os/actions/runs/3852075387)上传到对象存储,观察61秒后是否上传成功
#### Does this PR introduce a user-facing change?

<!--
如果当前 Pull Request 的修改不会造成用户侧的任何变更,在 `release-note` 代码块儿中填写 `NONE`。
否则请填写用户侧能够理解的 Release Note。如果当前 Pull Request 包含破坏性更新(Break Change),
Release Note 需要以 `action required` 开头。
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
-->

```release-note
去除上传文件处理时间超过30秒后的报错
```
JohnNiang pushed a commit to JohnNiang/halo that referenced this issue Mar 2, 2023
…ds (halo-dev/console#813)

<!--  Thanks for sending a pull request!  Here are some tips for you:
1. 如果这是你的第一次,请阅读我们的贡献指南:<https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>。
1. If this is your first time, please read our contributor guidelines: <https://github.com/halo-dev/halo/blob/master/CONTRIBUTING.md>.
2. 请根据你解决问题的类型为 Pull Request 添加合适的标签。
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request.
3. 请确保你已经添加并运行了适当的测试。
3. Ensure you have added or ran the appropriate tests for your PR.
-->

#### What type of PR is this?

<!--
添加其中一个类别:
Add one of the following kinds:
/kind bug
/kind cleanup
/kind documentation
/kind feature
/kind optimization
适当添加其中一个或多个类别(可选):
Optionally add one or more of the following kinds if applicable:
/kind api-change
/kind deprecation
/kind failing-test
/kind flake
/kind regression
-->
/kind improvement
#### What this PR does / why we need it:
Remove the timeout error prompt caused by the upload server processing for more than 30 seconds
#### Which issue(s) this PR fixes:

<!--
PR 合并时自动关闭 issue。
Automatically closes linked issue when PR is merged.
用法:`Fixes #<issue 号>`,或者 `Fixes (粘贴 issue 完整链接)`
Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
-->
Fixes halo-dev#3041
#### Screenshots:

<!--
如果此 PR 有 UI 的改动,最好截图说明这个 PR 的改动。
If there are UI changes to this PR, it is best to take a screenshot to illustrate the changes to this PR.
eg.
Before:
![screenshot-before](https://user-images.githubusercontent.com/screenshot.png)
After:
![screenshot-after](https://user-images.githubusercontent.com/screenshot.png)
-->
![image](https://user-images.githubusercontent.com/28662535/210917239-b4b050f8-766f-4289-9ba2-ccb99bb6ac55.png)
![image](https://user-images.githubusercontent.com/28662535/210917273-c6291485-f420-4f02-a7c8-2b4b286110d4.png)


#### Special notes for your reviewer:
测试:
上传大文件让后端处理过程超过30秒,观察是否报错
或使用[修改后的插件](https://github.com/longjuan/halo-plugin-s3os/actions/runs/3852075387)上传到对象存储,观察61秒后是否上传成功
#### Does this PR introduce a user-facing change?

<!--
如果当前 Pull Request 的修改不会造成用户侧的任何变更,在 `release-note` 代码块儿中填写 `NONE`。
否则请填写用户侧能够理解的 Release Note。如果当前 Pull Request 包含破坏性更新(Break Change),
Release Note 需要以 `action required` 开头。
If no, just write "NONE" in the release-note block below.
If yes, a release note is required:
Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
-->

```release-note
去除上传文件处理时间超过30秒后的报错
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/improvement Categorizes issue or PR as related to a improvement. triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants