On 21 Nov 2011, at 13:24, "Jan Vávra" <va...@602.cz> wrote:
> >>> Hello, >>> is there any way how to tell tomcat: Recycle after X minutes OR Y requests >>> like it is eg. on the IIS server? >> IIS can reboot itself after N requests? >> That's awesome. What could possibly go wrong? > > Yes, IIS can do recycling > See eg. at > http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/1652e79e-21f9-4e89-bc4b-c13f894a0cfe.mspx?mfr=true > It is a quite easy to setup it in the configuration. > > >> >> I might file an enhancement request for Tomcat... > If you have already done it, can I vote it for? > > >> >> >>> If I add my own script containing "/etc/init.d/tomcat restart" to the >>> crontab I loose the user sessions and users have to relogin. >> Yes... because you restarted the server! > As Chris Schultz wrote it is possible to persist sessions over tomcat > restarts. I chagned my session objects to be serializable and It works. > >> >>> I experience some problems with OutOfMemory error. >> Wouldn't it be better to understand and fix the OOM, rather than just >> rebooting the server frequently? > > Yes, it is allways better to solve the cause than the consequence of a > problem. But not allways man can have enough time or means to solve it. When > an error occurs at production it is better to setup some kind of recovery > (eg. recycling) and than solve it at pre-production / devel environment. You > can use a third party lib with an error. > > Particulary in my case, my app consists of a one single cycle where I > download a CRL, parse it using BouncyCastle lib and retrieve serial numbers > of revoked certificates. So the problem can rather in third party lib than in > my small piece of code. I've tried to profile memory consuption but have not > found out nothing. Maybe I had had not enough memory for java virtual > machine. I've set it from 128 MB to 512 MB and the problem have not occured > yet. > >> >> >>> On tomcat I run a periodic thread that downloads CRLs and I suspect this of >>> memory leaks. >> Why? Can't you fix that? > > If we forget the OOM exception, I was forced to make a ShutDownHook. I use > spring quartz scheduler and my job can run quite a long time. So I had to add > some notification to stop job correctly. Tomcat was complainting about > possible memory leaks when ending quartz job-worker threads when I was > stopping app for redeploy my app. Yes, Tomcat is helping you by warning you about a potential problem. The last time I looked at Quartz the shutdown process didn't actually wait for threads to finish before returning. I had a little success with Thread.yield() but I suspect that it would not be effective for multiple jobs or a longer process. > In a single process model (crontab) I could afford to kill -9 the process and > I could rely on transactionality in the database which I'm using. I'm not sure how that relates to this discussion. > At the end I'd like to make a little comparision. Recently I've used .NET + > native calls of dlls, php + custom made php modules (native dlls), jsp+java. > .NET and php have possibilities for some kind of recoveries. I'm not sure what that means. > It's almost imposible to crash Apache like a whole (control + x worker > processes). So .NET and php seems me they're more stable than tomcat because > they have some possibilites. I completely disagree. You're comparing two languages with an application server, for a start. > I haven't studied recovery options in other java app. servers, but I'd really > appriciate something in Tomcat. I think the harm this function would do would outweigh any perceived benefits. If you want to reboot Tomcat periodically employ cron and the service wrapper. p > Jan > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org