tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: AW:AJP suddenly Stopps acting: ajp on 7009 and 9009 : connections keept open
Date Thu, 14 Mar 2013 15:02:20 GMT
David Kumar wrote:
> Hey,
> thanks for note..
> Attached you can find a new list.
> So, java is keeping these connections in close_wait.

Yes.  Whether this is the java that runs tomcat is not immediately evident.
But it also seems that they concern port numbers like 7009, 9009 etc. which must be your 
AJP Connectors, so let's assume the CLOSE-WAITs all involve Tomcat.

The first observation hat I would make is that this looks like a pretty busy system.

Then, there are 2100+ lines in that list. Let's assume first that they are all internal 
connections (which probable they are not, but for simplicity), so that there are actually

2 lines for the same connection, like these :

tcp        0      0          FIN_WAIT2 
tcp6       1      0         CLOSE_WAIT  20564/java


So let's say that we have in total about 1000 connections active in some state.
Compared to that, there are 54 connections in CLOSE_WAIT, which is like 5%.
That does not really sound "pathological" to me, considering that CLOSE_WAIT is a normal 
state through which any TCP connection goes at some point.

If you look again at the above connection, and if I am not confusing my clients and 
servers again, it looks here like :
- Apache http (PID 20766), as a client, has established a connection to port 7009 of the 
server Tomcat (PID 20564). That must be an AJP connection, from the mod_jk module of 
Apache, to the AJP Connector in Tomcat.
- A while later, Apache closes the connection. It sends a "FIN" packet to Tomcat, and 
waits for Tomcat to acknowledge this FIN packet.
- when it receives the FIN packet from Apache, Tomcat responds with an ACK, and then goes

to the CLOSE_WAIT state.
- when Apache receives the ACK from Tomcat, it goes to state FIN_WAIT2.
   (and that is the current state of the above connection)
- now Tomcat is supposed to send a FIN to Apache, and receive an ACK in return.
- if Apache receives the FIN from Tomcat, it sends back an ACK, and goes into state 
TIME_WAIT (where it doesn't expect anything anymore), and then after a short moment, it 
discards that connection.

If there are connections that remain in the CLOSE_WAIT state for very long, it means that

something in the last 2 steps above is not working.

Now in your listing, we see about 1900 lines in the TIME_WAIT state, all of them *to* an 
AJP port of Tomcat.  This seems to suggest that the Apache side is working as it should.
But if the Tomcat side stays in CLOSE_WAIT for a long time, then it would suggest that on

the Tomcat side, that connection is never properly close()'d.

But this is the request/response connection, so I doubt that there would be a bug there, 
otherwise we'd have problems reports filling this list every day.

Might there be that there is somewhere a discrepancy between the keep-alive settings, 
between Apache and Tomcat ?

or maybe your server is just not strong enough for the load you are putting on it ?

> How about a "netstat -t -pan" ? it's a bit easier to find the relevant connections.
> If needed, tell us which processes are Tomcat instances/threads and which are Apache
> (if it is not evident from the list).
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
> Mit freundlichen Grüßen
> David Kumar  
> Softwareentwickler, B. Sc.
> Abteilung Infotech - Interaktiv 
> Am Weiher 14
> D-56766 Ulmen
> ------------------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message