I have a very strange problem and it is almost unreproducable. If someone would like to help me isolate the issue I'd be much abliged. I'm willing to do the research work on it, but need a few hints where to look. The following happens: We have an index.jsp which jsp:includes a menu.jsp. The menu.jsp is a relatively large plain text file. The menu.jsp is generated every night at midnight to reflect the changes of the day. Some days when we come in, the menu only shows partially. Other days the whole menu is shown. When checking the generated java and class files everything seems to be in order. The index.jsp has a JspRuntimeLibrary.include where the jsp:include was and the menu.jsp, menu_jsp.java and menu_jsp.class(decompiled to check) all resemble the new state. The index.jsp shows itself entirely, however only a part of the included html is shown. If the menu.jsp is recreated manually everything works again. A sidenote to this bug is that it only seems to occur with larger includes (this example is 1300 lines). Other sites we've created use the same method of including and menu generation with smaller menus and they have no problem.
[PURE SPECULATION] You are seeing a race condition. While the file (menu.jsp) is being generated to its destination - a request is made for it. During this sime time, a request is made for the file. The file is read incompletely by the JSP compiler, and the write happens quick enough that all of this occurs in the same second so the JSP engine does not detect a file change. I have seen this on tomcat404. You have 3 workarounds: 1) If its a plain text file, just call it menu.txt. This also saves some overhead of a JSP. 2) Generate the file to a temporary area on the same disk. Then use a file copy from/to local disk. 3) Tweak the jsp to force a compile error of itself if it is not complete. A simple brace <% { %> at the top of the file then closing brace at the bottom should work. It would be nice for Jasper to store the file size and date to perform its checks for situations such as this.
With no further comment on this bug I am going to assume that Tim's speculation was correct. There are a number of very simple work-arounds so I am going to set this as an enhancement request and change the summary accordingly.
*** This bug has been confirmed by popular vote. ***
I've been reviewing this one again. The bit that confuses me is that the menu_jsp.class file contains the latest version but clearly the version loaded by the class loader is an older version. The timestamp checks that take place are in milliseconds and a quick text shows that there is reasonably fine granularity with these. It does look like a race condition but one that I can't figure out given the current code. There have been changes to Jasper post 4.1.x (increased synchronisation, switch to the Eclipse compiler, improved dependency checking) and I don't recall any similar issues in 5.5.x onwards. Given the above, it isn't very satisfactory but I am going to resolve this as WONTFIX an the assumption that this was a 4.1.x bug that was fixed in 5.5.x onwards by the various changes.