tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rainer Jung <rainer.j...@kippdata.de>
Subject Re: Tomcats stops on Apache restart
Date Tue, 07 Apr 2009 06:33:53 GMT
On 07.04.2009 08:21, Leon Brouwers wrote:
> Hello Rainer,
> 
> Our scripts doesn't guess the pid. One of the script in question has
> the following lines:
> 
> PID_FILE=/vol/www/server/logs/httpd.pid ...
> 
> # Restart the httpd to build new logfiles kill -HUP `cat $PID_FILE`
> 
> This file only contains one pid which is het main httpd process.
> 
> host * ~ > cat /vol/www/server/logs/httpd.pid 4351
> 
> host * ~ > ps auxww| grep httpd root      4351  0.0  0.0 33484 4692 ?
> Ss   Apr03   0:00 /vol/www/server/bin/httpd www       4607  0.0  0.0
> 35800 5040 ?        S    Apr06   0:01 /vol/www/server/bin/httpd www
> 8796  0.0  0.0 33648 4664 ?        S    00:05   0:00
> /vol/www/server/bin/httpd ....
> 
> The other way we start apache is thru the apachectl script which also
> doesn't guess the PID but just calls the httpd binary with a "-k
> restart" argument.
> 
> So I don't think the problem is somewhere in the way we restart
> apache. Do you have any other ideas on how to debug this?

- Does it happen always, when you restart/stop httpd?
- Does it happen at the exact same time?

If so, you can start strace against the Java process and stop httpd.
Then check in the strace output (write to a file), whether you can
either see a signal sent, or a connect on the Tomcat shutdown port.

A slightly similar thing I once saw was people starting Tomcat
interactively with a shell, that did not have job control and sent some
signal to all child processes, when the user terminated the shell, resp.
logged out (I think it was ksh on Solaris at that time).

Regards,

Rainer

> Groeten Leon
> 
> -- Leon Brouwers System Engineer
> 
> GX open for business
> 
> t: +31(0)24 - 388 82 61 f: +31(0)24 - 388 86 21 e: leonb@gx.nl
> 
> KvK: 10044410
> 
>> -----Original Message----- From: Rainer Jung
>> [mailto:rainer.jung@kippdata.de] Sent: Tuesday, April 07, 2009
>> 0:22 To: Tomcat Users List Subject: Re: Tomcats stops on Apache
>> restart
>> 
>> On 01.04.2009 09:46, Leon Brouwers wrote:
>>> Hello,
>>> 
>>> We have a large number of tomcats (5.5.26) on serveral servers.
>>> These tomcats communicate with a apache httpd on the same server
>>> using mod_jk (1.2.26). They all work fine until I restart apache
>>> httpd. Then randomly and certainly not all the time a tomcat
>>> stops working. Seeing the time the tomcat shuts down matches the
>>> time apache was restarted it seems to lead to the conclusion that
>>> the two events are related. For that reason I have patched my
>>> tomcats to be able so see with it's being stopped.
>>> 
>>> I have changed (source 1.2.26)
>>> 
>> container/catalina/src/share/org/apache/catalina/core/StandardService.j
>>
>> 
ava
>>> 
>> On line 483 I have added a:
>>> Thread.dumpStack();
>>> 
>>> This gives me the following in the catalina.out during a httpd 
>>> restart:
>>> 
>>> java.lang.Exception: Stack trace at 
>>> java.lang.Thread.dumpStack(Thread.java:1158) at
>>> 
>> org.apache.catalina.core.StandardService.stop(StandardService.java:483)
>>>
>>
>> 
at
>> org.apache.catalina.core.StandardServer.stop(StandardServer.java:734)
>>>
>> 
at org.apache.catalina.startup.Catalina.stop(Catalina.java:602) at
>>> 
>> org.apache.catalina.startup.Catalina$CatalinaShutdownHook.run(Catalina.
>>
>> 
java:645)
>>> 
>> Apr 1, 2009 12:05:16 AM org.apache.catalina.core.StandardService
>> stop
>>> INFO: Stopping service WebManager Apr 1, 2009 12:05:16 AM 
>>> org.apache.catalina.core.StandardWrapper unload INFO: Waiting for
>>> 4 instance(s) to be deallocated Apr 1, 2009 12:05:17 AM 
>>> org.apache.catalina.core.StandardWrapper unload INFO: Waiting for
>>> 4 instance(s) to be deallocated Apr 1, 2009 12:05:18 AM 
>>> org.apache.catalina.core.StandardWrapper unload INFO: Waiting for
>>> 4 instance(s) to be deallocated
>>> 
>>> What could be the reason the ShutdownHook is called? The apache 
>>> restart happens thru a "kill -HUP" on the apache httpd main PID.
>>> So no signals should be sent to tomcat.
>> There is no technical reason for Tomcat to shut down, when you
>> stop Apache. I woiuld guess, the way you retrieve the PID for
>> Apache gives you multiple PIDs including the Tomcat PID. A normal
>> kill on the Tomcat java process will call the shutdown hook.
>> 
>> Make your script or whatever you use output the PIDs it kills and 
>> check, to which processes they belong.
>> 
>> Regards,
>> 
>> Rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message