Bug 6907 - jsp compiler not synchronized
Summary: jsp compiler not synchronized
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 4
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 4.0.2 Final
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-03-06 10:13 UTC by Dylan Schell
Modified: 2005-03-20 17:06 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dylan Schell 2002-03-06 10:13:55 UTC
When X clients request the same jsp page, jasper tries to compile the
page X times ( assuming the page was not compiled before) this leads
to very high memory usage and potentially to out of memory errors (even
if memory would normally be sufficient for the expected load). Using jikes
as a compiler reduces the overall memory problem, but still swamps the 
processor as X copies are run at the same time.

Is this the expected behaviour?
Comment 1 Dylan Schell 2002-03-06 13:52:42 UTC
I tried to work around this problem by synchronizing access to the java 
compiler, however this only reduces the problem. since the java sourcecode
is generated again and again until it compiles. So 1 thread is busy compiling
while another is trying to overwrite the source code. Scenario:

2 clients access the same page at approximately the same time
Thread 1: Generate Java code ( class not found )
Thread 2: Generate Java code ( class not found )
Thread 1: write classfile to disk
Thread 2: write classfile to dist ( fails because file is in use )
Thread 1: Generate Java code ( source is newer because of Thread 2 )
Thread 1: Compile Java code ( again! )
Comment 2 Vicente Salvador 2002-04-23 19:36:42 UTC
So maybe this is not a "synchronize" scenario. Maybe a semaphore status should
be included on Jasper to take out this behavour.
Comment 3 Kin-Man Chung 2002-04-24 02:23:31 UTC
Fixed in jasper2.