[MAGNOLIA-304] Cache problem with magnolia Created: 08/Mar/05  Updated: 25/Apr/05  Resolved: 08/Mar/05

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: 2.1 Final
Fix Version/s: 2.1 Final

Type: Bug Priority: Blocker
Reporter: Tom Wespi Assignee: Sameer Charles
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Win XP / Magnolia 2.02 / Single Tomcat Instance


Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   
  • situation: cache dir is empty after activating a page
  • if 2 or more request at the same time try the load and cache the page, magnolia can't cache it. it creates a file with 0 kb
  • only if one user (request) and no other loads the page the caching works. if two or more users try to load the page at the same time, caching doesn't work.


 Comments   
Comment by Andreas Weder [ 09/Mar/05 ]

Any chance we'll see this fix on the 2.02 branch?

Comment by Andreas Weder [ 09/Mar/05 ]

Is this what it needs to apply the patch to 2.02?

diff -u -r1.1 CacheHandler.java
— CacheHandler.java 2005/01/06 10:40:10 1.1
+++ CacheHandler.java 2005/03/09 09:23:20
@@ -71,9 +71,11 @@
*

  • @param request
    */
  • public synchronized static void cacheURI(HttpServletRequest request) throws IOException {
  • if (CacheHandler.hasRedirect(request)) /* dont cache */
  • return;
    + public static synchronized void cacheURI(HttpServletRequest request) throws IOException {
    +
    + if (Cache.isCached(request))
    + return;
    +
    String URI = Path.getURI(request);
    FileOutputStream out = null;
    int size = 0;
Comment by Andreas Weder [ 09/Mar/05 ]

Sameer: "exactly, in current version it was not synchronized"

Thx, Andreas

Comment by Tom Wespi [ 09/Mar/05 ]

Hello Andrea

may you please post the compiled class in the wiki? this would be great!

regards tom

Comment by Andreas Weder [ 25/Apr/05 ]

Here's the patch for this bug in the 2.02 branch:

Index: C:/Projects/Magnolia_2_02_Branch/src/main/info/magnolia/cms/core/CacheHandler.java
===================================================================
— C:/Projects/Magnolia_2_02_Branch/src/main/info/magnolia/cms/core/CacheHandler.java (revision 547)
+++ C:/Projects/Magnolia_2_02_Branch/src/main/info/magnolia/cms/core/CacheHandler.java (working copy)
@@ -72,8 +72,10 @@

  • @param request
    */
    public synchronized static void cacheURI(HttpServletRequest request) throws IOException {
  • if (CacheHandler.hasRedirect(request)) /* dont cache */
  • return;
    +
    + if (Cache.isCached(request))
    + return;
    +
    String URI = Path.getURI(request);
    FileOutputStream out = null;
    int size = 0;
Comment by Fabrizio Giustina [ 25/Apr/05 ]

ok, fixed committed to the 2.02 branch too

Generated at Mon Feb 12 03:16:06 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.