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

InterruptedException always occurs while requesting template pages #4468

Open
jxd134 opened this issue Aug 23, 2023 · 8 comments
Open

InterruptedException always occurs while requesting template pages #4468

jxd134 opened this issue Aug 23, 2023 · 8 comments
Assignees
Labels
area/core Issues or PRs related to the Halo Core kind/bug Categorizes issue or PR as related to a bug.
Milestone

Comments

@jxd134
Copy link

jxd134 commented Aug 23, 2023

What is version of Halo has the issue?

2.8.0

What database are you using?

MySQL 8.x

What is your deployment method?

Docker Compose

Your site address.

www.2tuan.site

What happened?

提交文章时,日志出现模板解析错误,具体如下所示:
image

Relevant log output

2023-08-23T17:22:45.187+08:00 ERROR 8 --- [boundedElastic-5] org.thymeleaf.TemplateEngine             : [THYMELEAF][boundedElastic-5] Exception processing template "post": Error during execution of processor 'org.thymeleaf.standard.processor.StandardWithTagProcessor' (template: "post" - line 106, col 9)

org.thymeleaf.exceptions.TemplateProcessingException: Error during execution of processor 'org.thymeleaf.standard.processor.StandardWithTagProcessor' (template: "post" - line 106, col 9)
	at org.thymeleaf.processor.element.AbstractAttributeTagProcessor.doProcess(AbstractAttributeTagProcessor.java:117) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.processor.element.AbstractElementTagProcessor.process(AbstractElementTagProcessor.java:95) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.util.ProcessorConfigurationUtils$ElementTagProcessorWrapper.process(ProcessorConfigurationUtils.java:633) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement(ProcessorTemplateHandler.java:1314) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.engine.OpenElementTag.beHandled(OpenElementTag.java:205) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.engine.Model.process(Model.java:282) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.engine.ProcessorTemplateHandler.handleStandaloneElement(ProcessorTemplateHandler.java:1204) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.engine.StandaloneElementTag.beHandled(StandaloneElementTag.java:228) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.engine.Model.process(Model.java:282) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement(ProcessorTemplateHandler.java:1587) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.engine.OpenElementTag.beHandled(OpenElementTag.java:205) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.engine.TemplateModel.process(TemplateModel.java:136) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:592) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1103) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1077) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.spring6.SpringWebFluxTemplateEngine.lambda$createFullStream$0(SpringWebFluxTemplateEngine.java:198) ~[thymeleaf-spring6-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at reactor.core.publisher.MonoCreate.subscribe(MonoCreate.java:58) ~[reactor-core-3.5.8.jar:3.5.8]
	at reactor.core.publisher.Mono.subscribe(Mono.java:4495) ~[reactor-core-3.5.8.jar:3.5.8]
	at reactor.core.publisher.MonoSubscribeOn$SubscribeOnSubscriber.run(MonoSubscribeOn.java:126) ~[reactor-core-3.5.8.jar:3.5.8]
	at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:84) ~[reactor-core-3.5.8.jar:3.5.8]
	at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:37) ~[reactor-core-3.5.8.jar:3.5.8]
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:na]
	at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]
Caused by: reactor.core.Exceptions$ReactiveException: java.lang.InterruptedException
	at reactor.core.Exceptions.propagate(Exceptions.java:408) ~[reactor-core-3.5.8.jar:3.5.8]
	at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:95) ~[reactor-core-3.5.8.jar:3.5.8]
	at reactor.core.publisher.Mono.block(Mono.java:1712) ~[reactor-core-3.5.8.jar:3.5.8]
	at run.halo.app.theme.ReactiveSpelVariableExpressionEvaluator.evaluate(ReactiveSpelVariableExpressionEvaluator.java:37) ~[classes/:2.8.0]
	at org.thymeleaf.standard.expression.VariableExpression.executeVariableExpression(VariableExpression.java:166) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.standard.expression.SimpleExpression.executeSimple(SimpleExpression.java:66) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.standard.expression.Expression.execute(Expression.java:109) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.standard.expression.Expression.execute(Expression.java:138) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.standard.expression.Expression.execute(Expression.java:125) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.standard.processor.StandardWithTagProcessor.doProcess(StandardWithTagProcessor.java:93) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	at org.thymeleaf.processor.element.AbstractAttributeTagProcessor.doProcess(AbstractAttributeTagProcessor.java:74) ~[thymeleaf-3.1.1.RELEASE.jar:3.1.1.RELEASE]
	... 25 common frames omitted
Caused by: java.lang.InterruptedException: null
	at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(Unknown Source) ~[na:na]
	at java.base/java.util.concurrent.CountDownLatch.await(Unknown Source) ~[na:na]
	at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:90) ~[reactor-core-3.5.8.jar:3.5.8]
	... 34 common frames omitted

Additional information

插件信息

@ruibaby
Copy link
Member

ruibaby commented Aug 25, 2023

这个异常应该和保存文章没有关系,你是无法保存文章还是?

/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 Aug 25, 2023
@jxd134
Copy link
Author

jxd134 commented Sep 5, 2023

这个异常应该和保存文章没有关系,你是无法保存文章还是?

/triage needs-information

很奇怪,保存文章是正常的。
发现此问题是,偶然查看日志,发现有此记录。
后面测试,每次编辑文章时,会出现此错误。

@jxd134
Copy link
Author

jxd134 commented Sep 5, 2023

可以关闭此issue,自从调整堆大小至2G,此类报错日志消失不见了

@jxd134 jxd134 closed this as completed Sep 5, 2023
@JohnNiang
Copy link
Member

当前问题可能和内存关系不大。大概率发生在访问过程中客户端断开连接。

建议重新打开当前 Issue,等待解决。

/reopen
/area core
/kind bug

@f2c-ci-robot f2c-ci-robot bot reopened this Sep 5, 2023
@f2c-ci-robot f2c-ci-robot bot added the area/core Issues or PRs related to the Halo Core label Sep 5, 2023
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Sep 5, 2023

@JohnNiang: Reopened this issue.

In response to this:

当前问题可能和内存关系不大。大概率发生在访问过程中客户端断开连接。

建议重新打开当前 Issue,等待解决。

/reopen
/area core
/kind bug

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.

@f2c-ci-robot f2c-ci-robot bot added the kind/bug Categorizes issue or PR as related to a bug. label Sep 5, 2023
@JohnNiang JohnNiang added kind/bug Categorizes issue or PR as related to a bug. area/core Issues or PRs related to the Halo Core and removed kind/bug Categorizes issue or PR as related to a bug. area/core Issues or PRs related to the Halo Core triage/needs-information Indicates an issue needs more information in order to work on it. labels Sep 5, 2023
@JohnNiang JohnNiang changed the title 提交文章时,提示模板解析错误 InterruptedException always occurs while requesting template pages Oct 20, 2023
@ruibaby ruibaby added this to the 2.14.x milestone Mar 6, 2024
@ruibaby
Copy link
Member

ruibaby commented Mar 6, 2024

ping @halo-dev/sig-halo

建议优先解决一下此问题,这个问题会严重影响查看日志时对问题的判断。

@JohnNiang
Copy link
Member

/assign

@JohnNiang
Copy link
Member

当前问题似乎很难直接修改 Halo 的源码来解决。原因如下:

出现 InterruptedException 的主要原因是我们在页面渲染的过程中调用了 Mono#block 或者 Flux#block 方法,这两个方法会使当前线程处于等待状态,一旦客户端请求断开连接,当前线程将会被打断,并抛出 InterruptedException,但该异常被 Thymeleaf 捕获并打印错误日志。实际上,该异常完全可以忽略。

目前只修改 Halo 的源码无法直接解决,即使修改 Thymeleaf 源码(目前缺乏维护和响应)也需要修改不少地方。

由于当前异常暂时不会影响正常的业务逻辑,暂时不做处理。如果后续能够更换模板引擎,或许是解决问题的办法之一。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Issues or PRs related to the Halo Core kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants