MyFaces 中的内存泄漏
编辑:您可以在下面的评论中找到的解决方案假设更改 JSF 实现从 MyFaces 到 Sun 的 Mojarra。
嗨,
我在 MyFaces 2.0.0 上遇到了非常烦人的问题(更准确地说,我也在 2.0.1 和 2.0.2 上检查过它,问题仍然存在)。
我现在正在 MyFaces 下编写应用程序。简而言之,在我的应用程序中我使用框架:Spring、Hibernate、JSF(MyFaces 实现) 我的应用程序容器是Tomcat(6.0.29版本) 我使用maven来构建和部署(版本3.0)。
问题是当我尝试通过 maven (mvn tomcat:redeploy) 重新部署应用程序时,它首先尝试取消部署应用程序并再次部署它。但取消部署从未成功。我得到信息:
SEVERE: The web application [/adam] created a ThreadLocal with key of type
[java.lang.ThreadLocal] (value [java.lang.ThreadLocal@4b0a4d7c]) and a value of type
[org.apache.myfaces.config.RuntimeConfig] (value org.apache.myfaces.config.RuntimeConfig@11652e61])
but failed to remove it when the web application was stopped.
This is very likely to create a memory leak.
由于此错误,tomcat 无法取消部署应用程序:
INFO: Undeploying context [/adam]
2010-12-02 11:47:46 org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [D:\Program Files\apache-tomcat-6.0.29\webapps\adam\WEB-INF\lib] could not be completely deleted. The presence of the remaining files may cause problems
2010-12-02 11:47:46 org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [D:\Program Files\apache-tomcat-6.0.29\webapps\adam\WEB-INF] could not be completely deleted. The presence of the remaining files may cause problems
2010-12-02 11:47:46 org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [D:\Program Files\apache-tomcat-6.0.29\webapps\adam] could not be completely deleted. The presence of the remaining files may cause problems
2010-12-02 11:47:46 org.apache.catalina.startup.ExpandWar delete
SEVERE: [D:\Program Files\apache-tomcat-6.0.29\webapps\adam] could not be completely deleted. The presence of the remaining files may cause problems
2010-12-02 11:47:49 org.apache.catalina.startup.HostConfig deployDirectory
WEB-INF\lib 中的所有库以及保存 Log4J 日志的文件无法删除。
提供 ELFactoryImpl 的库还存在连接的内存泄漏:
SEVERE: The web application [/adam] created a ThreadLocal with key of type [null]
(value [org.apache.myfaces.el.convert.VariableResolverToELResolver$1@693985fc])
and a value of type [java.util.HashSet] (value [[]]) but failed to remove it
when the web application was stopped.
This is very likely to create a memory leak.
如何消除这种内存泄漏?
我一直在寻找答案很长时间我找不到任何解决方案。 我在 myface 的 jira 上发现了这个问题: https://issues.apache.org/jira/browse /MYFACES-2942 但我不知道该怎么想。我应该等待 2.0.3 版本吗?
我认为 EL 的内存泄漏与第一个有关。
请帮我 ! ;) 如果需要,我可以提供更多详细信息。
EDIT: The solution that you can find in comments below assumes changing
JSF implemenetation from MyFaces to
Sun's Mojarra.
Hi,
I have got really annoying problem with MyFaces 2.0.0 (To be more precisely I checked it out also on 2.0.1 and 2.0.2 and problem remains).
I'm writing now application under MyFaces. Briefly speaking in my application i use frameworks: Spring, Hibernate, JSF (MyFaces implementation)
My application container is Tomcat (6.0.29 version)
I use maven to build and deploy (version 3.0).
The problem is when I try to redeploy application via maven (mvn tomcat:redeploy) it tries first to undeploy application and the deploy it again. But undeploying never suceed. I've got information:
SEVERE: The web application [/adam] created a ThreadLocal with key of type
[java.lang.ThreadLocal] (value [java.lang.ThreadLocal@4b0a4d7c]) and a value of type
[org.apache.myfaces.config.RuntimeConfig] (value org.apache.myfaces.config.RuntimeConfig@11652e61])
but failed to remove it when the web application was stopped.
This is very likely to create a memory leak.
Due to this error tomcat cannot undeploy application:
INFO: Undeploying context [/adam]
2010-12-02 11:47:46 org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [D:\Program Files\apache-tomcat-6.0.29\webapps\adam\WEB-INF\lib] could not be completely deleted. The presence of the remaining files may cause problems
2010-12-02 11:47:46 org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [D:\Program Files\apache-tomcat-6.0.29\webapps\adam\WEB-INF] could not be completely deleted. The presence of the remaining files may cause problems
2010-12-02 11:47:46 org.apache.catalina.startup.ExpandWar deleteDir
SEVERE: [D:\Program Files\apache-tomcat-6.0.29\webapps\adam] could not be completely deleted. The presence of the remaining files may cause problems
2010-12-02 11:47:46 org.apache.catalina.startup.ExpandWar delete
SEVERE: [D:\Program Files\apache-tomcat-6.0.29\webapps\adam] could not be completely deleted. The presence of the remaining files may cause problems
2010-12-02 11:47:49 org.apache.catalina.startup.HostConfig deployDirectory
All of my libraries in WEB-INF\lib and my file where i keep logs from Log4J cannot be deleted.
There is also connected memory leak from library that provides ELFactoryImpl:
SEVERE: The web application [/adam] created a ThreadLocal with key of type [null]
(value [org.apache.myfaces.el.convert.VariableResolverToELResolver$1@693985fc])
and a value of type [java.util.HashSet] (value [[]]) but failed to remove it
when the web application was stopped.
This is very likely to create a memory leak.
How to get rid of this memory leaks ?
I have been looking for answer really long I cannot find any solution.
I found this issue on myface's jira: https://issues.apache.org/jira/browse/MYFACES-2942
But I don't know what to think about it. Should I wait for version 2.0.3 ?
I think that memory leak from EL is connected to first one.
Please, help me ! ;) I can provide more details if needed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该问题已被报告并将得到修复。截至目前,您有 3 个选择:
接受警告消息并等待 MyFaces 人员发布修复程序。
在当前的 MyFaces 实现中应用建议的补丁。
将 MyFaces 替换为 Mojarra (参考实现),这样就不会暴露此问题。
The problem has already been reported and will be fixed. As of now you have 3 options:
Live with the warning message and wait until MyFaces guys release the fix.
Apply the proposed patch in your current MyFaces implementation.
Replace MyFaces by Mojarra (the reference implementation) which doesn't expose this problem.