tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bodycombe, Andrew" <andrew.bodyco...@siemens.com>
Subject RE: Weird Problems
Date Tue, 10 Feb 2004 16:18:38 GMT
I think the problem with your listener is that you assume the number of
active sessions will be 0 when the server starts up. Tomcat may persist
(passivate) sessions when the server is shut down. These sessions will be
re-activated the next time the server starts up.

If you reduce your session counter in the sessionWillPassivate() method and
increase the session counter in the sessionDidActivate() method, that may
get around your problem.

I think your 404 problem needs further investigation. 7-8% seems a very high
error rate.

Regards,
	Andy

-----Original Message-----
From: Vernon Wu [mailto:vwu98034@lycos.com] 
Sent: 10 February 2004 16:10
To: Tomcat Users List
Subject: RE: Weird Problems


Thanks Yoav for your response. 

>>The first problem is the session counter. It is implemented with the
>>HttpSessionListener. It works fine until recently. Under the TC5.0.X,
>the
>>counter can be a negative figure.
>
>The problem is obviously in your session counter code: if you posted it,
>we could help more.
>

I wish I can say the same. It, however, doesn' explain why the problem only
occurs recently. I note it on TC 5.0.x with the same code (I believe). Here
is the code segment:

public final class MyListener
	implements
		ServletContextListener,
		HttpSessionListener,
		HttpSessionActivationListener {


	private static int activeSessionCount = 0;

	public void contextInitialized(ServletContextEvent evt) {

// ...
	}

	public void contextDestroyed(ServletContextEvent evt) {

// ...
	}

	public void sessionCreated(HttpSessionEvent evt) {

		activeSessionCount++;
		HttpSession session = evt.getSession();
// ...
		logger.info(
			"The session ID: "
				+ session.getId()
				+ ", the total # of active sessions: "
				+ activeSessionCount);
	}

	public void sessionDestroyed(HttpSessionEvent evt) {

		activeSessionCount--;
		logger.debug("The number of active sessions: " +
activeSessionCount);
	}

	public void sessionWillPassivate(HttpSessionEvent evt) {
// ...
	}

	public void sessionDidActivate(HttpSessionEvent evt) {
		logger.info("sessionDidActivate");
	}

	public static int getActiveSessionCount() {
		return activeSessionCount;
	}
}

>>The second is a quite severe problem. I configure the welcome file to
>map a
>>JSP file. Sometimes, an incoming URL of the default domain leads to the
>404
>>error. After I click the reload button on my browser, the JSP file
>shows
>>up.
>
>You need to do better than "sometimes" in order to get precise help.
>When does it happen, when does it not happen, and what's in the logs in
>both cases?

If I could pin point the occasion, I might solve it by now. I don't observe
any logs from the container during the time when the error occurs, but I
would like to know how set up logging messages for the problem. I don't know
whether it is related with the container configuration. The tag pool is
disable. 

Also, some users report the 404 error on some other use scenario, but we
haven't observe the same. The error rate is above 7-8% of the total hits. If
a user follows the action options on a screen, the error shall never happen.


Vernon


____________________________________________________________
Find what you are looking for with the Lycos Yellow Pages
http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp
?SRC=lycos10

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

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


Mime
View raw message