You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Andrew Inggs <An...@teleca.com> on 2001/07/27 10:40:19 UTC

RE: Intermittent ferrors with ajp12 with tc3.2.1 on solaris with stronghold (apache)

John Thompson wrote:
> I start tomcat, start stronghold, try the servlet and get the 
> following in  mod_jk.log (set to debug) each time I try a page
> on tomcat.
> 
> Bizarre - if I wait for a while I get java.io.IOException on 
> the command line.

I don't see anything strange in the mod_jk.log.  Can you post the
the IOException details, they may be more useful.

> I get the following errors in mod_jk.log when set to debug.
> 
[...]
> 
> The first time I waited a while and it fixed itself.  
> Restarting does not help (does it hinder?).

Restarting what doesn't help, Tomcat or Stronghold (Apache)?

> This time,  I wait a while,  get the IO Exception,  then try 
> shutdown which fails (can't connect) then I try again and it
> starts working.
> 
> I assume I can't get a socket for some reason but I'm sure I
> checked 'netstat -a' which showed no traffic on that port.

I can't say for sure, but I suspect what's happening here is
that Tomcat cannot bind to the socket when it starts up, but
after a while it manages to.  This is a feature of the TCP
protocol (see http://www.faqs.org/faqs/unix-faq/socket/ 
section 2.7 "Please explain the TIME_WAIT state" for more
details).  The kernel forces a certain time to elapse before
any process (Tomcat in this case) can bind to a port that was
recently in use.

If I am right, however, it would mean that "netstat -a" would
show a TIME_WAIT state next to the ajp12 listener (port 8007),
so you'll want to double-check that the next time you experience
the problem.  If you don't see TIME_WAIT, then my guess is
probably wrong.

> Please can anyone tell me what is going on.  Browsing the 
> archives I see something about queues?
> 
> I have to confess that I tend to not bother restarting the 
> webserver each time I restart tomcat (does this make any
> difference?)

With ajp12 it may not be necessary.  With ajp13 you must
restart because the sockets are kept open.  If my above
guess is right, then stopping the webserver may well solve (or
at least help) your problem.  You should start and stop them
in this order:

Start: Tomcat, then Apache
Stop: Apache, then Tomcat

-- Andrew