tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andy Moller" <andymol...@gmail.com>
Subject Re: Tomcat 4.x (Major Problem)
Date Mon, 22 Jan 2007 21:39:12 GMT
This is the current environment:
JVM: Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
OS: Windows 2003 server (Version 5.2.3790)
Database: Oracle 9i (Release 9.2.0.1.0)
JDBC Driver: Netdirect JDataServer Version 2.20.1
Web/application server: Tomcat-Standalone (Apache Tomcat/4.0.3) / hosts 4
active applications


the jsp page contains these exact lines of code.
-----------------------------------------------------
String commonName = (String)session.getAttribute("commonName");
String[] value1 = (request.getParameterValues("value_1") != null)
        ? request.getParameterValues("value_1")
        : new String[0];

String[] value2 =
    (request.getParameterValues("value_2") != null)
        ? request.getParameterValues("value_2")
        : new String[0];

if (value1.length > 0 && value2.length > 0)
{
    connection= obj.createConnection();
    stmt= connection.createStatement();

    String query= "";

    for (int i= 0; i < value1.length; i++)
    {
        String singleVal1= value1[i];

        for (int j= 0; j < value2.length; j++)
        {
            try
            {
                query=
                    "insert into sample_table(id,val1,common_name,val2)"
                        + " values (sequence.nextVal,"
                        + singleVal1
                        + ",'"
                        + commonName
                        + "','"
                        + val2[j]
                        + "')";

                System.out.println(query);
                stmt.executeUpdate(query);
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
    }
}
-----------------------------------------------------

Where sample_table
(id number, val1 number, common_name varchar2, val2 varchar2)
-----------------------------------------------------

Assume the runtime values are:
commonName: nameA
value1: [111]
value2: [valueB1]

-----------------------------------------------------
The expected query printout should be:
    "insert into sample_table(id,val1,common_name,val2) values(
sequence.nextVal,111,'nameA','valueB1')"

However, the actual query printout (that cause an exception, and the
behavior I cannot justify)
    "insert into sample_table(id,val1,common_name,val2) values(
sequence.nextVal,nameB,'nameA','valueB1')"

Where the value "nameB" is the "commonName" session attribute value from a a
different session.
-----------------------------------------------------

The code is simple, and the query is printed on the stdout before it is
executed, that was the reason I suspected Tomcat as the reason for the
problem having a session leak somehow.

The application assumes about 25 concurrent sessions with heavy use of
session variables.


I hope this can help.

Thank you,
Andy
-----------------------------------------------------
On 1/19/07, Caldarale, Charles R <Chuck.Caldarale@unisys.com> wrote:
>
> > From: Andy Moller [mailto:andymoller@gmail.com]
> > Subject: Tomcat 4.x (Major Problem)
> >
> > I have a strange problem that I think Tomcat is causing it,
> > and I need to confirm if my assumptions are correct.
>
> We obviously don't have access to all the data you have available, but
> from what's been stated, your conclusions are not justified.  It would
> be nearly impossible for Tomcat (even the five-year-old, horribly out of
> date version you're running) to cause this kind of problem.  It is much,
> much more likely to be something subtle in your app, such as inadvertent
> data sharing via static or singleton variables or storing data in the
> wrong scope (e.g., request-specific items stored in a Session object).
>
> There is a very small chance that the problem could be any of the
> following, but you didn't bother to tell us what they are:
> 1) JVM (what level & vendor?)
> 2) OS (what level & vendor?)
> 3) data base (what level & vendor?)
> 4) JDBC driver (what level & vendor?)
>
> Since you used the term "JDBC Data Bridge", I fear you may be using the
> ancient ODBC bridge to some flavor of Microsoft data base (Access?).  If
> so, both ODBC and Access have long been proven to be completely
> inadequate for any form of production use.
>
> - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message