2

我面临一个神秘的问题,它对我的​​ Web 应用程序的可用性造成了严重破坏。一些背景 -

  • 服务器 - Apache+Tomcat7
  • Web 框架 - 带有 JSP 的 Struts2

在检查服务器注销较晚时,我收到了很多以下异常-

26092219 [http-bio-8080-exec-695] ERROR org.apache.struts2.components.template.FreemarkerTemplateEngine  - Could not load the FreeMarker template named 'hidden':
26092219 [http-bio-8080-exec-695] ERROR org.apache.struts2.components.template.FreemarkerTemplateEngine  - Attempted: /template/simple/hidden.ftl
26092219 [http-bio-8080-exec-695] ERROR org.apache.struts2.components.template.FreemarkerTemplateEngine  - The TemplateLoader provided by the FreeMarker Configuration was a: freemarker.cache.MultiTemplateLoader

Error reading included file template/simple/dynamic-attributes.ftl
The problematic instruction:

----------
==> include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" [on line 44, column 1 in template/simple/a-close.ftl]
----------

Java backtrace for programmers:
----------
freemarker.template.TemplateException: Error reading included file template/simple/dynamic-attributes.ftl
freemarker.template.TemplateException: Error reading included file template/simple/dynamic-attributes.ftl
    at freemarker.core.Include.accept(Include.java:167)
    at freemarker.core.Environment.visit(Environment.java:209)
    at freemarker.core.MixedContent.accept(MixedContent.java:92)
    at freemarker.core.Environment.visit(Environment.java:209)
    at freemarker.core.Environment.process(Environment.java:189)
    at freemarker.template.Template.process(Template.java:237)
    at org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:157)
    at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:559)
    at org.apache.struts2.components.Anchor.end(Anchor.java:145)
    at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
    at org.apache.jsp.jsp_005froot.ajax.synset.trackedCustomEntities_jsp._jspx_meth_gs_005fa_005f0(trackedCustomEntities_jsp.java:648)
    at org.apache.jsp.jsp_005froot.ajax.synset.trackedCustomEntities_jsp._jspx_meth_gs_005fif_005f2(trackedCustomEntities_jsp.java:573)
    at org.apache.jsp.jsp_005froot.ajax.synset.trackedCustomEntities_jsp._jspx_meth_gs_005fiterator_005f0(trackedCustomEntities_jsp.java:380)
    at org.apache.jsp.jsp_005froot.ajax.synset.trackedCustomEntities_jsp._jspService(trackedCustomEntities_jsp.java:128)
...

这种情况继续发生,然后导致 -too many open files像这样的异常,

java.io.FileNotFoundException: /opt/tomcat7/work/Catalina/localhost/_/loader/template/simple/form.ftl (Too many open files)
javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 25;
  nested exception is:
java.net.SocketException: Too many open files
    ...

我很困惑,主要是因为我在代码库中没有一个 freemarker 文件。我的猜测是,这是从我导入的某个库内部发生的,问题是我有大量的库,所以要逐个浏览它们并弄清楚哪个库的行为是不可行的。

温度。我的技巧是重新启动服务器并将“ulimit -n”大小加倍。但这只是一个创可贴。我想通过删除有问题的库或包含丢失的库来解决这个问题并解决它!?!?。

任何帮助表示赞赏。

更新 我在几个小时内收集的堆栈跟踪转储 - https://gist.github.com/4e22ffd19f0445521083希望这能提供一些指示。

4

0 回答 0