]
Remy Maucherat resolved JBWEB-57.
---------------------------------
Resolution: Rejected
Threading issue using tomcat
----------------------------
Key: JBWEB-57
URL:
https://jira.jboss.org/jira/browse/JBWEB-57
Project: JBoss Web
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Tomcat Module
Reporter: Lamon Gray
Assignee: Remy Maucherat
the threading bug observed in tomcat has been reproduced in data pool manager (dpm) on
both redhat linux enterprise server as 3 and microsoft windows xp professional version
2002 sp2 operating systems. we are currently running apache tomcat 5.5.9 coupled with j2se
5.0 update 6 in all of our environments.
to reproduce the threading bug, two users log in separately from different workstations
to the dpm application and on the main menu screen, both users click on the same link
simultaneously. tomcat processes the incoming requests properly most of the time and each
user is presented with the resulting web screen. however, about 1 out of every 10 times, a
series of exceptions is thrown and one user is forwarded to an error page. the enclosed
log file tomcat_thread_debug.log captures the results of one of these instances. because
the text is difficult to follow, we generated the enclosed file tomcatthreadingbug.png
which illustrates graphically the methods invoked by each thread and how individual
objects were updated as a function of time. use this illustration when walking through the
following summary of what i?s happening:
1) each user logs in to dpm and a unique DBService object is created for each user and
stored in each user'?s session object (DBService is a container for a single
Connection object and also manages transactions for the connection)
2) from the main menu page, both users select the Maintain Company Profile link
simultaneously
3) a unique ClientCompanyProfileInfoMaintenance object is created for each user and each
user's DBService object is passed in as an argument
4) Thread1 [Thread[http-14104-Processor24,5,main] opens a Connection [1ecfcd9] retrieved
from the connection pool and stores it in DBService [6f19d5]
5) Thread2 [Thread[http-14104-Processor22,5,main] opens a Connection [311410] retrieved
from the connection pool and stores it in DBService [8809ce]
6) Thread1 then closes the Connection [null] in DBService [6f19d5]
7) Thread1 then attempts to open the Connection [311410] that was previously opened by
Thread2 in DBService [8809ce]; attempting to open a connection that has already been
opened is flagged as an exception and Exception1 is thrown
8) Thread2 closes the Connection [null] in DBService [8809ce]
9) Thread1 then attempts to get a Connection [null] that was previously closed by Thread2
in DBService [8809ce]; attempting to get a Connection that is closed is flagged as an
exception and Exception2 is thrown; Thread1 then opens a new Connection [311410] retrieved
from the connection pool and stores it in DBService [8809ce]
10)Thread2 then opens a new Connection [1ecfcd9] retrieved from the connection pool and
stores it in DBService [8809ce] replacing the previous connection
11)Thread1 continues and then ends its transaction performing a commit which causes the
next result set retrieved by Thread2 to throw Exception3 which is a NullPointerException
runtime exception
the problem is that after starting out on the right track, Thread1 ceases operating on
its own DBService object and then begins operating on Thread2's DBService object
concurrent with Thread2's operations. we don't understand how this is possible
since the Connection object is defined as an instance variable in the DBService class and
there are 2 unique DBService objects created and each is stored in a separate unique
session object created by tomcat. again, this only happens about 1 out of every 10 times
and works properly the rest of the time.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: