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 Thu, 07 Nov 2019 14:07:26 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

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?

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.

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

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl3EJR0ACgkQHPApP6U8
pFhjPg/+IhLbsElRysCanRnFKZ6JPMEFs2oPHLwWJxxBGunPQZ2k7fpm6b8q7RUE
ChLhwQifzgNRWuM76mB3lMqcv767jZ0mHCWTIcr1kzb+90QSBxVWziSWH9r7V9zj
+eCIu3Z2Oh+1vL5Yp1D3M7GzmNONx9TztuijiQXZnKQMEvBwfu5Y/r3kbOswLHFu
BOdWSwuxyzpkTBIB6wKxZnaSCWT1AO3/9VIzK5zxWBDikj6m7s85m9U7rP9zYg7g
EZKe87pNFGmI1w2kxAb9ghBMHHzYh/vjljFp+dEA+liNrgAa8g9Y7lDTP9fizC5z
C9Cjw++JGEFSZ8jMdkSbMMk5dbio0K36AgWakuUGKCPtRVMBOmIVtjgprwpxBQ8w
uyG8WczjKDmFgUSQHqFxE7geH73YoRj66xAdtqQRg9QaI8sn00vENvFSbV0m76nT
yTx8BBrIaCtPAjXkGQ9ve2uECgils3slkUhScx0aRAGOBRuDC9fTXyKoCmSy5RTm
BhjLcoRlp9pO1HPtpz6SQJW1gyMuag8LoArb2Dw/XRDNjzKhjSqU6qgqfDIiS2UL
xeDX9KRP3yJP76RDYNS1r6ty6YTZ4V2yk7Bmhe1xyVahWaLszPRZjCaar0mp85/I
kGpt5CY45UXKPXGKCCvNHLs6MQLIAMIl5mPSBF5cnSa8qf8bDOg=
=a7/B
-----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