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

menuFinder.getPrimary() 无法正常使用 (Exception evaluating SpringEL expression: "menuFinder.getPrimary()") #7059

Open
4 tasks done
HowieHz opened this issue Nov 21, 2024 · 2 comments
Labels
triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@HowieHz
Copy link

HowieHz commented Nov 21, 2024

前置条件

  • 已经在 issues 列表中搜索了相关问题。
  • 这是 Halo 项目本身存在的问题,如果是非项目本身的问题(如:安装部署问题),建议在 Discussions 提交。
  • 已经尝试过停用所有的插件,排除是插件导致的问题。
  • 如果是插件和主题的问题,请在对应的插件和主题仓库提交。

系统信息

使用的哪种方式运行?

Docker

发生了什么?

本地测试环境不会报错,部署到 docker 后会报错。
实际菜单也会渲染,但是会卡一下反应比较慢。

<!-- template: "fragments/common" - line 19 -->
<th:block th:fragment="base-menu" th:with="menu = ${menuFinder.getPrimary()}"> 
  <th:block th:with="menuItems = ${menu.menuItems}">
    <th:block th:unless="${theme.config?.global?.is_i18n_menu_show}">
      <!-- 普通 menu -->
      <li th:each="menuItem : ${menuItems}" class="matched-menu">
        <a
          th:href="@{${menuItem.status?.href}}"
          th:target="${menuItem.spec.target?.value}"
          th:aria-label="#{fragment.menu.menuItem.aria-label(${menuItem.status?.displayName})}"
          th:text="${menuItem.status?.displayName}"
          >目录项填充位置</a
        >
      </li>
    </th:block>

    <!-- ...  -->
  </th:block>
 </th:block>

原来的写法是 <th:block th:each="menuItem : ${menuFinder.getPrimary().menuItems}"> 但是频繁报错,于是查找文档,模仿文档的方式写。可是依旧报错。

复现步骤

  • 以下日志为报错部分

相关日志输出

halo  | org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "menuFinder.getPrimary()" (template: "fragments/common" - line 19, col 35)
halo  | 	at org.thymeleaf.spring6.expression.SPELVariableExpressionEvaluator.evaluate(SPELVariableExpressionEvaluator.java:292) ~[thymeleaf-spring6-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at run.halo.app.theme.ReactiveSpelVariableExpressionEvaluator.evaluate(ReactiveSpelVariableExpressionEvaluator.java:36) ~[classes/:2.20.9]
halo  | 	at org.thymeleaf.standard.expression.VariableExpression.executeVariableExpression(VariableExpression.java:166) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.standard.expression.SimpleExpression.executeSimple(SimpleExpression.java:66) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.standard.expression.Expression.execute(Expression.java:109) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.standard.expression.Expression.execute(Expression.java:138) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.standard.expression.Expression.execute(Expression.java:125) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.standard.processor.StandardWithTagProcessor.doProcess(StandardWithTagProcessor.java:93) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.processor.element.AbstractAttributeTagProcessor.doProcess(AbstractAttributeTagProcessor.java:74) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.processor.element.AbstractElementTagProcessor.process(AbstractElementTagProcessor.java:95) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.util.ProcessorConfigurationUtils$ElementTagProcessorWrapper.process(ProcessorConfigurationUtils.java:633) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement(ProcessorTemplateHandler.java:1314) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.engine.OpenElementTag.beHandled(OpenElementTag.java:205) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.engine.Model.process(Model.java:300) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.engine.OpenElementTagModelProcessable.process(OpenElementTagModelProcessable.java:110) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.engine.ProcessorTemplateHandler.queueProcessable(ProcessorTemplateHandler.java:2106) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement(ProcessorTemplateHandler.java:1559) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.engine.OpenElementTag.beHandled(OpenElementTag.java:205) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.engine.Model.process(Model.java:300) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.engine.OpenElementTagModelProcessable.process(OpenElementTagModelProcessable.java:110) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.engine.ProcessorTemplateHandler.queueProcessable(ProcessorTemplateHandler.java:2106) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement(ProcessorTemplateHandler.java:1559) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.engine.OpenElementTag.beHandled(OpenElementTag.java:205) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.engine.Model.process(Model.java:300) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.engine.StandaloneElementTagModelProcessable.process(StandaloneElementTagModelProcessable.java:114) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.engine.ProcessorTemplateHandler.handlePending(ProcessorTemplateHandler.java:2054) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.engine.ThrottledTemplateProcessor.process(ThrottledTemplateProcessor.java:230) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.engine.ThrottledTemplateProcessor.process(ThrottledTemplateProcessor.java:200) ~[thymeleaf-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.spring6.SpringWebFluxTemplateEngine$StreamThrottledTemplateProcessor.process(SpringWebFluxTemplateEngine.java:720) ~[thymeleaf-spring6-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at org.thymeleaf.spring6.SpringWebFluxTemplateEngine.lambda$createChunkedStream$2(SpringWebFluxTemplateEngine.java:269) ~[thymeleaf-spring6-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	at reactor.core.publisher.FluxGenerate$GenerateSubscription.slowPath(FluxGenerate.java:271) ~[reactor-core-3.7.0-RC1.jar:3.7.0-RC1]
halo  | 	at reactor.core.publisher.FluxGenerate$GenerateSubscription.request(FluxGenerate.java:213) ~[reactor-core-3.7.0-RC1.jar:3.7.0-RC1]
halo  | 	at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.request(FluxPeekFuseable.java:144) ~[reactor-core-3.7.0-RC1.jar:3.7.0-RC1]
halo  | 	at reactor.core.publisher.FluxSubscribeOn$SubscribeOnSubscriber.requestUpstream(FluxSubscribeOn.java:131) ~[reactor-core-3.7.0-RC1.jar:3.7.0-RC1]
halo  | 	at reactor.core.publisher.FluxSubscribeOn$SubscribeOnSubscriber.onSubscribe(FluxSubscribeOn.java:124) ~[reactor-core-3.7.0-RC1.jar:3.7.0-RC1]
halo  | 	at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onSubscribe(FluxPeekFuseable.java:178) ~[reactor-core-3.7.0-RC1.jar:3.7.0-RC1]
halo  | 	at reactor.core.publisher.FluxGenerate.subscribe(FluxGenerate.java:85) ~[reactor-core-3.7.0-RC1.jar:3.7.0-RC1]
halo  | 	at reactor.core.publisher.InternalFluxOperator.subscribe(InternalFluxOperator.java:68) ~[reactor-core-3.7.0-RC1.jar:3.7.0-RC1]
halo  | 	at reactor.core.publisher.FluxSubscribeOn$SubscribeOnSubscriber.run(FluxSubscribeOn.java:194) ~[reactor-core-3.7.0-RC1.jar:3.7.0-RC1]
halo  | 	at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:84) ~[reactor-core-3.7.0-RC1.jar:3.7.0-RC1]
halo  | 	at reactor.core.scheduler.WorkerTask.call(WorkerTask.java:37) ~[reactor-core-3.7.0-RC1.jar:3.7.0-RC1]
halo  | 	at java.base/java.util.concurrent.FutureTask.run(Unknown Source) ~[na:na]
halo  | 	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[na:na]
halo  | 	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:na]
halo  | 	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:na]
halo  | 	at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]
halo  | Caused by: reactor.core.Exceptions$ReactiveException: java.lang.InterruptedException
halo  | 	at reactor.core.Exceptions$ReactiveException.fillInStackTrace(Exceptions.java:736) ~[reactor-core-3.7.0-RC1.jar:3.7.0-RC1]
halo  | 	at java.base/java.lang.Throwable.<init>(Unknown Source) ~[na:na]
halo  | 	at java.base/java.lang.Throwable.<init>(Unknown Source) ~[na:na]
halo  | 	at java.base/java.lang.Exception.<init>(Unknown Source) ~[na:na]
halo  | 	at java.base/java.lang.RuntimeException.<init>(Unknown Source) ~[na:na]
halo  | 	at reactor.core.Exceptions$ReactiveException.<init>(Exceptions.java:726) ~[reactor-core-3.7.0-RC1.jar:3.7.0-RC1]
halo  | 	at reactor.core.Exceptions.propagate(Exceptions.java:410) ~[reactor-core-3.7.0-RC1.jar:3.7.0-RC1]
halo  | 	at reactor.core.publisher.BlockingOptionalMonoSubscriber.blockingGet(BlockingOptionalMonoSubscriber.java:158) ~[reactor-core-3.7.0-RC1.jar:3.7.0-RC1]
halo  | 	at reactor.core.publisher.Mono.blockOptional(Mono.java:1861) ~[reactor-core-3.7.0-RC1.jar:3.7.0-RC1]
halo  | 	at run.halo.app.infra.utils.ReactiveUtils.blockReactiveValue(ReactiveUtils.java:45) ~[classes/:na]
halo  | 	at run.halo.app.infra.utils.ReactiveUtils.blockReactiveValue(ReactiveUtils.java:28) ~[classes/:na]
halo  | 	at run.halo.app.theme.dialect.EvaluationContextEnhancer$ReactiveMethodExecutor.lambda$execute$1(EvaluationContextEnhancer.java:206) ~[classes/:2.20.9]
halo  | 	at java.base/java.util.Optional.map(Unknown Source) ~[na:na]
halo  | 	at run.halo.app.theme.dialect.EvaluationContextEnhancer$ReactiveMethodExecutor.execute(EvaluationContextEnhancer.java:206) ~[classes/:2.20.9]
halo  | 	at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:152) ~[spring-expression-6.2.0-RC3.jar:6.2.0-RC3]
halo  | 	at org.springframework.expression.spel.ast.MethodReference$MethodValueRef.getValue(MethodReference.java:398) ~[spring-expression-6.2.0-RC3.jar:6.2.0-RC3]
halo  | 	at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:97) ~[spring-expression-6.2.0-RC3.jar:6.2.0-RC3]
halo  | 	at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:116) ~[spring-expression-6.2.0-RC3.jar:6.2.0-RC3]
halo  | 	at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:338) ~[spring-expression-6.2.0-RC3.jar:6.2.0-RC3]
halo  | 	at org.thymeleaf.spring6.expression.SPELVariableExpressionEvaluator.evaluate(SPELVariableExpressionEvaluator.java:265) ~[thymeleaf-spring6-3.1.2.RELEASE.jar:3.1.2.RELEASE]
halo  | 	... 45 common frames omitted
halo  | 	Suppressed: java.lang.Exception: #blockOptional(timeout) has been interrupted
halo  | 		at reactor.core.publisher.BlockingOptionalMonoSubscriber.blockingGet(BlockingOptionalMonoSubscriber.java:160) ~[reactor-core-3.7.0-RC1.jar:3.7.0-RC1]
halo  | 		... 57 common frames omitted
halo  | Caused by: java.lang.InterruptedException: null
halo  | 	at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(Unknown Source) ~[na:na]
halo  | 	at java.base/java.util.concurrent.CountDownLatch.await(Unknown Source) ~[na:na]
halo  | 	at reactor.core.publisher.BlockingOptionalMonoSubscriber.blockingGet(BlockingOptionalMonoSubscriber.java:150) ~[reactor-core-3.7.0-RC1.jar:3.7.0-RC1]
halo  | 	... 57 common frames omitted
halo  |

附加信息

No response

@HowieHz HowieHz changed the title menuFinder.getPrimary() 无法正常使用 menuFinder.getPrimary() 无法正常使用 (Exception evaluating SpringEL expression: "menuFinder.getPrimary()") Nov 21, 2024
@ruibaby
Copy link
Member

ruibaby commented Nov 28, 2024

实际菜单也会渲染,但是会卡一下反应比较慢。

能够渲染就证明 API 并没有问题,卡的话就不清楚是什么原因了。

这个日志看起来和 #4468 一致。

@ruibaby ruibaby added the triage/needs-information Indicates an issue needs more information in order to work on it. label Nov 28, 2024
@HowieHz
Copy link
Author

HowieHz commented Nov 28, 2024

实际菜单也会渲染,但是会卡一下反应比较慢。

能够渲染就证明 API 并没有问题,卡的话就不清楚是什么原因了。

这个日志看起来和 #4468 一致。

卡顿确定是 #7071,驱动换 mysql 就不会卡了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

No branches or pull requests

2 participants