無駄にはまった

Tomcat7停止時にworkディレクトリが問答無用で削除されて、SESSIONS.serやJSPの中間ソースなども全部なくなっちゃうのなんでだろう?とか昨日の夜からはまってた。原因は単なるバグだったのだが、そもそもちょっと古いバージョンのTomcatを使ってたのが間違い。Tomcat7.0.16を使ってた。最新安定版は7.0.20。デグレでレアケースのためかグーグル先生も教えてくれなかった。何か明らかに挙動が変なときは最新バージョンをチェックしましょう。無駄にはまった記念のメモ。


org.apache.catalina.startup.ContextConfig#destroy
SVN Revision1137693

The fix for bug 51310 caused a regression that re-introduced bug 49957 and deleted the contents of the work directory when Tomcat was shutdown. This fix ensures that that work directory for an application is not deleted when Tomcat is shutdown.

// Skip clearing the work directory if Tomcat is being shutdown
Server s = getServer();
if (s != null && !s.getState().isAvailable()) {
    return;
}

https://issues.apache.org/bugzilla/show_bug.cgi?id=51310
https://issues.apache.org/bugzilla/show_bug.cgi?id=49957