我正在使用我认为是相当标准的 FusionAuth 安装。从几天前开始,管理员用户一直无法访问位于 [myhost]:[myport]/admin/ 的仪表板(除此之外,FusionAuth 似乎正常工作)。
一旦用户输入了他们的登录凭据,页面会在一段时间内(通常是几分钟)无响应,然后才会向他们显示此(显然是通用的)消息: 在此处输入图像描述
StdErr 日志显示以下内容: 2020 年 6 月 8 日下午 3:05:34 org.apache.catalina.core.StandardWrapperValve 调用严重:Servlet.service() for servlet [default] in context with path [] throw exception org.primeframework .mvc.freemarker.FreeMarkerRenderException:freemarker.core.InvalidReferenceException:以下已评估为 null 或缺失:==> loginData [在模板“WEB-INF/templates/admin/index.ftl”中,第 23 行,第 46 列]
index.ftl的相关部分如下:
[@layout.html]
[@layout.head]
<script>
Prime.Document.onReady(function() {
new FusionAuth.Admin.Dashboard([[#list loginData.labels as label]"${label}"[#sep], [/#list]],
[[#list loginData.counts as count]${count}[#sep], [/#list]]);
});
</script>
[/@layout.head]
...并且 loginData 变量声明如下:
[#-- @ftlvariable name="loginData" type="io.fusionauth.app.service.ReportUtil.ReportData" --]
如果用户输入了错误的密码,他们会收到通常的失败消息,几乎没有延迟;此问题似乎发生在初始身份验证后。我知道 loginData 可能是一份报告,但不确定它的重要性(当我通过 Postman 调用 API 时,标准的 FusionAuth 登录报告似乎工作正常)。有没有人有类似的问题?
编辑:我被告知这是一个标准安装,推荐使用 Elasticsearch 和 MySQL。用户数不被认为是异常的(总数报告给出了 7500 到 8500 范围内的 globalRegistrations 和 totalGlobalRegistrations)。
附加信息:
版本:
- 操作系统:Windows Server 2019 标准版,V1809
- mysql: 8.0
- 弹性搜索:6.3.1
- 融合认证:1.9.1
此 FusionAuth 系统最近没有已知的故意更改
发生错误时,最初在 JS 控制台中没有报告错误,但我现在看到一个与缺少“]”有关的错误,原因是下面看到的错误消息似乎已插入页面来源,大概是在使用模板生成时:
<script>
var FusionAuth = FusionAuth || {};
FusionAuth.requestContextPath = '';
FusionAuth.loginURI = FusionAuth.requestContextPath + '/login';
</script>
<script>
Prime.Document.onReady(function() {
new FusionAuth.Admin.Dashboard([FreeMarker template error (DEBUG mode; use RETHROW in production!):
The following has evaluated to null or missing:
==> loginData [in template "WEB-INF/templates/admin/index.ftl" at line 23, column 46]
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use [#if myOptionalVar??]when-present[#else]when-missing[/#if]. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: #list loginData.labels as label [in template "WEB-INF/templates/admin/index.ftl" at line 23, column 39]
~ Reached through: #nested [in template "WEB-INF/templates/_layouts/admin.ftl" in macro "head" at line 124, column 3]
~ Reached through: @layout.head [in template "WEB-INF/templates/admin/index.ftl" at line 20, column 1]
~ Reached through: #nested [in template "WEB-INF/templates/_layouts/admin.ftl" in macro "html" at line 14, column 3]
~ Reached through: @layout.html [in template "WEB-INF/templates/admin/index.ftl" at line 19, column 1]
----
Java stack trace (for programmers):
----
freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...]
at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134)
at freemarker.core.UnexpectedTypeException.newDesciptionBuilder(UnexpectedTypeException.java:85)
at freemarker.core.UnexpectedTypeException.<init>(UnexpectedTypeException.java:48)
at freemarker.core.NonHashException.<init>(NonHashException.java:49)
...
可能的原因:我确实看到了一些明显的 MySQL 超时,现在我来检查 StdOut 日志而不是 StdErr;也许这就是问题所在;将确认- 从头开始;最新的案例没有伴随任何明显的 MySQL 相关日志条目。
最新的完整错误消息(从堆栈跟踪中删除了一些行以节省空间。此错误之前没有直接出现在 StdOut 或 StdErr 日志中的任何内容;它是 StdErr 日志中当天的第一个条目):
Jun 11, 2020 9:55:13 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [default] in context with path [] threw exception
org.primeframework.mvc.freemarker.FreeMarkerRenderException: freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
==> loginData [in template "WEB-INF/templates/admin/index.ftl" at line 23, column 46]
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use [#if myOptionalVar??]when-present[#else]when-missing[/#if]. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: #list loginData.labels as label [in template "WEB-INF/templates/admin/index.ftl" at line 23, column 39]
~ Reached through: #nested [in template "WEB-INF/templates/_layouts/admin.ftl" in macro "head" at line 124, column 3]
~ Reached through: @layout.head [in template "WEB-INF/templates/admin/index.ftl" at line 20, column 1]
~ Reached through: #nested [in template "WEB-INF/templates/_layouts/admin.ftl" in macro "html" at line 14, column 3]
~ Reached through: @layout.html [in template "WEB-INF/templates/admin/index.ftl" at line 19, column 1]
----
at org.primeframework.mvc.freemarker.DefaultFreeMarkerService.render(DefaultFreeMarkerService.java:69)
...
at io.fusionauth.app.primeframework.FusionAuthMVCWorkflow.perform(FusionAuthMVCWorkflow.java:93)
...
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
==> loginData [in template "WEB-INF/templates/admin/index.ftl" at line 23, column 46]
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use [#if myOptionalVar??]when-present[#else]when-missing[/#if]. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: #list loginData.labels as label [in template "WEB-INF/templates/admin/index.ftl" at line 23, column 39]
~ Reached through: #nested [in template "WEB-INF/templates/_layouts/admin.ftl" in macro "head" at line 124, column 3]
~ Reached through: @layout.head [in template "WEB-INF/templates/admin/index.ftl" at line 20, column 1]
~ Reached through: #nested [in template "WEB-INF/templates/_layouts/admin.ftl" in macro "html" at line 14, column 3]
~ Reached through: @layout.html [in template "WEB-INF/templates/admin/index.ftl" at line 19, column 1]
----
at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134)
...
at org.primeframework.mvc.freemarker.DefaultFreeMarkerService.render(DefaultFreeMarkerService.java:65)
... 35 more
解决方法:例如,如果我们转到 [host:port]/admin/user(即指定仪表板以外的页面),则可以正常使用实际的管理功能。
NB如果我们尝试使用 [host:port]admin/system/login-record/ 会出现类似 的 问题- 运行缓慢并锁定数据库连接:
SELECT
rl.applications_id AS applicationId,
rl.instant AS instant,
rl.ip_address AS ipAddress,
rl.users_id AS userId,
a.name AS applicationName,
COALESCE(i.email, i.username) AS loginId
FROM raw_logins AS rl
INNER JOIN applications AS a ON a.id = rl.applications_id
INNER JOIN identities AS i ON i.users_id = rl.users_id
ORDER BY rl.instant DESC
LIMIT 5
OFFSET 0
这是标准的 FusionAuth 查询吗?是否报告了性能问题?