Why shouldn't i turn on “antiJARLocking” in production environment?

本小妞迷上赌 提交于 2019-12-05 14:30:31
Mark Thomas

Tomcat's anti-resource locking features are provided to work around bugs in deployed web applications that result in files being opened but not closed. On some operating systems - primarily Windows - this prevents the file from being deleting which in turn prevents the web application from being fully undeployed. Usually, the only way to delete those files is to stop Tomcat first. The anti-resource locking copies the web application to a uniquely named directory in the work directory and deploys it from a there. Each redployment gets a new directory so not being able to delete the old directory is not an immediate problem.

There is no specific reason why the anti-resource locking features should not be used in production. However, you do need to be aware that locked files are effectively a memory leak and after multiple redeploys you may end up filling permGen and triggering an OOME.

The quick and dirty solution to odbc6.jar being locked is to move it from WEB-INF/lib to $CATALINA_HOME/lib. The better solution is to figure out why it is locked (you'll probably need to use a combination of a profiler and a debugger to find the root cause) and fix it.

According to this wiki,

You should NOT turn this option on in production. The antiResourceLocking option can stop JSPs from redeploying when they are edited (a reploy [sic] of the webapp is required instad [sic] and sometimes a clean out of the work directory). There are small restrictions apparently on not being able to get certain kinds of resource paths to webapp resources for webapps that are being run from the special "temp" area but we have never run into them in practice.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!