This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hello everyone, I'm experiencing an odd problem and having a rather difficult time finding answers online -- has anyone else experienced something like this?
I'm running a webapp using Java in Tomcat 5.5. During some simultaneous testing the other day, my coworker and I found that if we both tried to retrieve the same data set at the same moment, one of us would see data returned on the JSP and one would not.
It seemed to only occur when retrieving large amounts of data from the database, so I investigated this further on my local machine, logging into the app with two users at once, one in firefox and one in IE, using eclipse debugger to see if this was a database transaction problem or not.
I cut out the database portion entirely, instead creating a large ArrayList of objects within Java. I found that the problem didn't occur until I created a large list with 50,000 objects in it. Code is as follows:
List bmpCatList2 = (List)request.getSession().getAttribute(attr); LOG.debug("ERS: got the list." + bmpCatList2);
Joined: Apr 25, 2008
Whoops, submitted before I was finished.
Anyway, if I watch both requests from Firefox and IE come in via Eclipse debugger, I can see that each user gets their bmpCatList1 populated with all 50k objects. Then the call to place the list in the session occurs.
At this point user2's list (the user who clicked second) is put into the session successfully. Pulling it back out in bmpCatList2 shows results. User1's instance however, fails to place the data in the session. The line is executed and nothing happens. Then, when the same list is pulled back out below, bmpCatList2 shows "null."
I am appending the session_ids to the attribute name to ensure they weren't "overwriting" each other in the session (even though they are different requests) and saw that the session ids were in fact different.
So why does User1 get their results "cut off" so to speak, with User1 getting their data and having to placed successfully in the session?