Hi JSP enthusiasts,

Ever since I started playing more seriously with JSP's a few months ago
(ie. getting paid for it), I have been suffering what appears to be
memory leaks in the web apps.  Or maybe not ?  I'm hoping someone can
give me a few pointers on how to further investigate this.  The runtime
environment is JDK 1.2.2, JSWDK 1.0, Win NT 4.0, MS Access 98.

The web app is a simple affair, about 4 different JSP pages (no
servlets) that query and MS Access database using search criteria
entered in form fields and produce various reports.  Each JSP page has
some session and request scoped beans defined with <jsp:usebean> and
then your normal scriptlets and jsp tags to produce the result.  I have
appended the text of one of the pages at the end of this message, if
anyone is *really* keen...

(I have to tell you, this stuff is SOOO much better to develop and
maintain than the ASP apps we have done in the past, even without the
tag extensions comming in 1.1)

The thing is, after I start the JSWDK server and exercise each page, the
Win NT Task Manager shows the java.exe VM using about 12Mb of virtual
memory.  Over a few days (probably only 100 page hits), this will creep
up to about 25Mb, at which stage I normally stop and restart the server
and it goes back to 12Mb.  If I let it go long enough, The JSWDK server
will get an "Out of virtual memory" error from NT.  Has anyone else had
this sort of problem ?

I have gone though all the bean code and make sure I am closing all the
JDBC result sets and prepared statements, I had read that these can
cause leaks in the JDBC-ODBC driver ?

My current thought is that perhaps the session stored beans are never
being released and thus stopping the tree of objects they reference from
being GC'd ?  There is a bit in the webserver.xml comments that reads

    The WebApplication.maxInactiveInterval is not
    utilized at this time and will likely specify
    the "session time out in minutes" threshold in
    a future release.

Does this mean that sessions never time-out ?  I'm pretty sure that when
I close the browser and reconnect I get a new session, which I think
makes sense because I belive the session mechanism uses non-persistant
cookies.  But maybe the old session is still hanging around in the
server forever ?

This would be bad, as most of my beans keep a reference to the last
calling page context, to get access to the various bean scopes.  (This
in itself is not ideal, as it makes it impossible to make the JSP page
thread-safe, I'm working on something different, but suggestions on this
are also welcome!)

So, can someone out there *confirm* that sessions definately do timeout
(after how long ?) and the JSWDK de-references all objects stored in the
session scope ?  I can then rule that out as my problem.

Failing that, any suggestions on how to investigate this sort of problem
would be appreaciated.  I did manage to get the JSWDK 1.0 ea running
under the JProbe evaluation, but I could not find anything conclusive,
due to my lack of expertise with the product.  It looks like I may have
to invest some more time there....

Thanks

Drew Cox
Barrack Consulting


===JSP Page Code===

<!-- Create a reference to DB connection pool into the application scope
if not already
 present and mark page not thread-safe -->
<%@ include file="/common.jsp" %>

<%-- Declare Beans --%>

<jsp:useBean id="HDCallList" class="barrack.helpdesk.CallList"
scope="request"/>
<jsp:setProperty name="HDCallList"  property="pageContext"
value="<%=pageContext%>" />

<jsp:useBean id="HDClientList" class="barrack.ccr.ClientList"
scope="session"/>
<jsp:setProperty name="HDClientList" property="pageContext"
value="<%=pageContext%>" />

<jsp:useBean id="HDStatusList" class="barrack.ccr.StatusList"
scope="session"/>
<jsp:setProperty name="HDStatusList" property="pageContext"
value="<%=pageContext%>" />

<%-- Set Bean properties from request parameters --%>

<jsp:setProperty name="HDCallList" property="filterClient"
param="filterClient"/>
<jsp:setProperty name="HDCallList" property="filterStatus"
param="filterStatus"/>
<jsp:setProperty name="HDCallList" property="filterCall"
param="filterCall"/>
<jsp:setProperty name="HDCallList" property="filterXClient"
param="filterXClient"/>
<jsp:setProperty name="HDCallList" property="filterXStatus"
param="filterXStatus"/>

<jsp:setProperty name="HDClientList"  property="selectedClient"
param="filterClient"/>
<jsp:setProperty name="HDStatusList"  property="selectedStatus"
param="filterStatus"/>

<html>

<head>
  <link REL="stylesheet" TYPE="text/css" HREF="/barrack.css">
  <title>LA Office Help Desk Call Report</title>
  <SCRIPT SRC="/common.js"></SCRIPT>
</head>

<body class="report">

<p>
<span class="heading1">LA Office Help Desk Call Report</span>
&nbsp;&nbsp;&nbsp;
[ <a href="javascript:openHelpWindow('help.htm')">Help</a> ]
</p>
<p>
<span class="heading2">Enter Search Criteria</span>
</p>

<form method="GET" action="extCallReport.jsp">

  <table class="searchCriteria">

    <tr>

      <th>Client</th>
      <td><select name="filterClient" size="1">
            <option value="%">All</option>
            <jsp:getProperty name="HDClientList"
property="clientOptions"/>
          </select>
      </td>
      <td><input type="checkbox" name="filterXClient"
            <jsp:getProperty name="HDCallList"
property="filterXClient"/> >
          Exclude
      </td>

    </tr><tr>

      <th>Status</th>
      <td><select name="filterStatus" size="1">
            <option value="%">All</option>
            <jsp:getProperty name="HDStatusList"
property="statusOptions"/>
          </select>
      </td>
      <td><input type="checkbox" name="filterXStatus"
            <jsp:getProperty name="HDCallList"
property="filterXStatus"/>
          >
          Exclude
      </td>

      <td><input type="submit" value="Go" name="Go"></td>

    </tr>

  </table>
</form>

<form method="GET" action="extCallReport.jsp">
  <table class="searchCriteria">
    <tr>
      <td><span class="heading2">Or</span></td>
      <td>&nbsp;</td>
      <th>Call No</th>
      <td><input type="text" name="filterCall" size="5"
           value="<jsp:getProperty name="HDCallList"
property="filterCall"/>">
      </td>
      <td><input type="submit" value="Go" name="Go"></td>
    </tr>
  </table>
</form>

<hr>

<%
    /*
    * Only do this bit if there has been a Go
    */
    if (request.getParameter("Go") != null) {

        barrack.helpdesk.Call[] calls = HDCallList.getCallList();

%>

<h2><%=calls.length%> Matching Calls</h2>

<table class="reportOutput">
<%
        // Loop through CCRs
        for (int i=0; i < calls.length; i++ )
        {
%>
            <tr>
              <th nowrap>Call No</th>
                <td><%=calls[i].getCall_no()%></td>
              <th nowrap>Logged</th>
                <td><%=calls[i].getCall_date()%></td>
              <th nowrap>CCR No</th>
                <td><%= calls[i].getCcr_no() %></td>
            </tr><tr>
              <th nowrap>Client</th>
                <td><%=calls[i].getClient()%></td>
              <th nowrap>Status</th>
                <td><%=calls[i].getStatus()%></td>
              <th nowrap>Release</th>
                <td><%=calls[i].getVersion()%></td>
            </tr><tr>
              <th nowrap>User</th>
                <td><%= calls[i].getCall_by()%></td>
              <th nowrap>Status Changed</th>
                <td><%=calls[i].getStatus_date()%></td>
              <th nowrap>&nbsp;</th>
                <td>&nbsp;</td>
            </tr><tr>
              <th nowrap>Description</th>
                <td colspan=5><%=calls[i].getDescription() %></td>
            </tr><tr>
              <th nowrap>Resolution</th>
                <td colspan=5><%=calls[i].getResolution() %></td>
            </tr><tr>
              <td colspan=6><hr></td>
            </tr>

<%
        } // end loop
%>

</table>

<%
    } // end if
%>

</body>
</html>

===End Code===

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to