tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: Intermittent JSP Caching/Compiling Issue while under load
Date Fri, 08 Nov 2019 14:30:09 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Mark,

On 11/7/19 11:43, Mark Thomas wrote:
>> Mark,
>> 
>> On 11/7/19 06:40, Mark Thomas wrote:
>>> On 06/11/2019 20:04, Mark Thomas wrote:
>>>> I've found the root cause.
>>>> 
>>>> When checking the timestamps of JSPs, the JSP engine (because
>>>> it has to access all resources via the Servlet API) requests
>>>> a URL for the JSP, opens a connection to the URL and then
>>>> checks the last modified time. This goes directly to the
>>>> on-disk file.
>>>> 
>>>> When reading the content, the request goes via the static 
>>>> resource cache because we can intercept the call to 
>>>> ServletContext.getResourceAsStream()
>>>> 
>>>> The problem is the following sequence: - request for JSP -
>>>> no change in JSP timestamp found - cache re-validated (for 5s
>>>> by default) - JSP is modified (within 5s) - request for JSP
>>>> (within 5s) - change in JSP timestamp found - JSP content
>>>> read (sees cached version rather than new version)
>>>> 
>>>> So we end up with the old version of the JSP content with
>>>> the updated last modification time.
>>>> 
>>>> I'm currently looking at options to return a URL for the
>>>> resource where we can intercept the call to 
>>>> URLConnection.getLastModified().
>> 
>>> Fixed in: - master for 9.0.28 onwards - 8.5.x for 8.5.48
>>> onwards
>> 
>> Would you mind checking similar logic for triggering the
>> reloading of a whole context?
> 
> No at all.
> 
>> I'm not sure it's happened to me in quite a while (I'm currently
>> on 8.5.x), but in the past I know for a fact that I've been
>> caught in a loop where my context will reload many many times
>> after what feels like one single change (e.g. one set of class
>> file updates, a new .jar file, etc.). Usually, if I leave things
>> alone for a while (maybe 2 minutes?) Tomcat will settle down and
>> stop repeatedly reloading the context, but I usually just kill it
>> and restart the container because all that reloading causes the
>> service to perform really poorly. After a restart, all is well.
> 
> Doesn't look to be related. See HostConfig.checkResources(). The
> checks are all directly to the file system. Also. reloading the web
> application will clear the resources cache.

Thanks for looking. It's possible that it's all been completely fixed
since the last time I suffered from this. If it happens again, I'll
definitely report it.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl3Fe/AACgkQHPApP6U8
pFiLrg//R8jAmLoFBFZ+rkdhsNEg/Ld4JzaKH7+ZeiKkrfYI9aX6BeqCz1i3h8Zf
WZalZgxy6KVQ1+1mnbbDVxlKdQixDmNQn+aB05SrQI/9oM12CNWrkSP2p/bbGAS1
4ThTC4ZvBKV+z+8eCwS1nRmZxL8auCBiqGPC3CLJ9t7Kz5edRmgJZCKP/61ROOqE
SMA72fon/3nnxa4X8fUmfiQYBaz34IK6p1Jno7arRDpv2rpazsZ/s4ZRmx8JNgwp
3TRyDaDf8owrlOLRT3tOhGP6+ZwPypXQHcljWyz4kHgaxLjywiWLdyE4S+pshUK4
XG3a9VTagOCW1T8vptO8l2xIZ6zZ9rKsjcjbbmHYslPpPNIrjsa3x4YHLg58dehq
IgW35mEfcgyp0j3f6+yX/ceYSUKZnNEp4du3n97s59kRegdTStbEps3wQWz/AgZJ
weLwBKEM7QulTP1Q0eXXSithoxTlCxcMO+Vbvug7AXvu+sazmdUuyyUqYpTNMp+l
yD/9efVActP0WkzbC5H8UJEBqLE08aj2TKo4vbalOunORLF/+gfqMjdpqSu//UQj
0n8T+wqf+BtHhsFo8XOXjr5bSOTiC6R2CyS8N2mbAyxfs0B+wUq97Ox9k/egRAcT
V0TTcVLrOOMeHcyKCSdUTUgo7BcoZZ82Os5tRYozpypBbKtQp/k=
=VYIw
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message