[MGNLADVCACHE-116] Site aware caching no longer creates site caches Created: 11/Aug/20 Updated: 30/Jul/21 Resolved: 22/Jul/21 |
|
| Status: | Closed |
| Project: | Advanced Cache |
| Component/s: | None |
| Affects Version/s: | 2.3.3 |
| Fix Version/s: | 2.3.4 |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Richard Gange | Assignee: | Federico Grilli |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | cache, maintenance, site-aware | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | 1h 22m | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||||||||||||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||
| Template: |
|
||||||||||||||||||||||||||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||||||||||||||||||||||||||
| Task DoD: |
[X]*
Doc/release notes changes? Comment present?
[X]*
Downstream builds green?
[X]*
Solution information and context easily available?
[X]*
Tests
[X]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||||||||||||||||||||||||||||||||||||||
| Bug DoR: |
[X]*
Steps to reproduce, expected, and actual results filled
[X]*
Affected version filled
|
||||||||||||||||||||||||||||||||||||||||
| Date of First Response: | |||||||||||||||||||||||||||||||||||||||||
| Sprint: | Maintenance 67 | ||||||||||||||||||||||||||||||||||||||||
| Story Points: | 3 | ||||||||||||||||||||||||||||||||||||||||
| Description |
|
By adding some additional logging ( Set your log4j2.xml when using the snapshots from the attached tickets:
<Logger name="info.magnolia.module.cache" level="ALL"/>
<Logger name="info.magnolia.module.advancedcache" level="ALL"/>
Recreate:
Expected: Workaround: Notes 2020-08-11 18:39:47,213 DEBUG info.magnolia.module.cache.filter.CacheFilter :
Cache policy result: CachePolicyResult{behaviour=store, cacheName=defaultPageCache,
cacheKey=DefaultCacheKey{uri='/home.html', serverName='localhost', locale='en',
The home site does not have a site definition. However, shouldn't the cache be called "home" as well. It would be great if we could clarify in the instructions how it works. When using the workaround of touching the cache config the log reports the caches as being uninitialized. See cache-uninitialized.txt Solution |
| Comments |
| Comment by Roman Kovařík [ 12/Aug/20 ] |
|
This might got broken with The startup sequence should be:
But now the site registration seems to be postphoned:
Workaround: |
| Comment by Richard Gange [ 12/Aug/20 ] |
|
Yes, you are right. Refreshing did help. Now the travel and sportstation site are behaving correctly. One problem still exists. I have another site called home. When I refreshed the cache I did get a home cache created. It should be known I added a configuration that looks like this now: 'contentCaching': 'defaultPageCache': ... ... ... 'travel': 'extends': '../defaultPageCache' 'sportstation': 'extends': '../defaultPageCache' 'home': 'extends': '../defaultPageCache' So I am explicitly configuring the caches by name. However, a request for home still goes into defaultPageCache: 2020-08-12 15:30:54,731 INFO r.operation.jcr.JcrTransactionPublicationOperation: 376:1597239050436 User superuser successfully published website:/sportstation on dx-core-webapp.
2020-08-12 15:30:59,885 WARN nfo.magnolia.module.cache.ehcache3.EhCache3Wrapper: Cache named {site} is UNINITIALIZED. Ignoring any calls on it. This might happen when editing the Ehcache factory configuration at runtime
2020-08-12 15:30:59,885 TRACE ule.advancedcache.SiteAwareFlushAllListeningPolicy: Cache flushed: site
2020-08-12 15:30:59,888 TRACE ule.advancedcache.SiteAwareFlushAllListeningPolicy: Cache flushed: home
2020-08-12 15:30:59,890 TRACE ule.advancedcache.SiteAwareFlushAllListeningPolicy: Cache flushed: sportstation
2020-08-12 15:30:59,891 TRACE info.magnolia.module.cache.FlushAllListeningPolicy: Cache flushed: uuid-key-mapping
2020-08-12 15:30:59,898 TRACE ule.advancedcache.SiteAwareFlushAllListeningPolicy: Cache flushed: defaultPageCache
2020-08-12 15:31:28,758 DEBUG info.magnolia.module.cache.filter.CacheFilter : Cache policy result: CachePolicyResult{behaviour=useCache, cacheName=travel, cacheKey=DefaultCacheKey{uri='/travel.html', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{}'}, cachedEntry=info.magnolia.module.cache.filter.InMemoryCachedEntry@5247b616[gzippedContent=5459 bytes,plainContent=24683 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597238798255,originalUrl=http://localhost:8080/dx-core-webapp/travel.html,timeToLiveInSeconds=-1]}
2020-08-12 15:31:28,758 DEBUG info.magnolia.module.cache.executor.UseCache : Serving info.magnolia.module.cache.filter.InMemoryCachedEntry@5247b616[gzippedContent=5459 bytes,plainContent=24683 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597238798255,originalUrl=http://localhost:8080/dx-core-webapp/travel.html,timeToLiveInSeconds=-1]
2020-08-12 15:31:28,762 DEBUG info.magnolia.module.cache.filter.CacheFilter : Cache policy result: CachePolicyResult{behaviour=useCache, cacheName=travel, cacheKey=DefaultCacheKey{uri='/travel/main/0', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{mgnlCacheVariant={9b13970f-6b1b-451e-83fc-36cfde37f78e=0}}'}, cachedEntry=info.magnolia.module.cache.filter.InMemoryCachedEntry@76071c8d[gzippedContent=914 bytes,plainContent=4033 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597238980183,originalUrl=http://localhost:8080/dx-core-webapp/travel/main/0,timeToLiveInSeconds=-1]}
2020-08-12 15:31:28,763 DEBUG info.magnolia.module.cache.executor.UseCache : Serving info.magnolia.module.cache.filter.InMemoryCachedEntry@76071c8d[gzippedContent=914 bytes,plainContent=4033 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597238980183,originalUrl=http://localhost:8080/dx-core-webapp/travel/main/0,timeToLiveInSeconds=-1]
2020-08-12 15:31:28,764 DEBUG info.magnolia.module.cache.filter.CacheFilter : Cache policy result: CachePolicyResult{behaviour=useCache, cacheName=travel, cacheKey=DefaultCacheKey{uri='/travel/main/00', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{mgnlCacheVariant={9b13970f-6b1b-451e-83fc-36cfde37f78e=0}}'}, cachedEntry=info.magnolia.module.cache.filter.InMemoryCachedEntry@890c07c[gzippedContent=660 bytes,plainContent=2432 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597238980209,originalUrl=http://localhost:8080/dx-core-webapp/travel/main/00,timeToLiveInSeconds=-1]}
2020-08-12 15:31:28,764 DEBUG info.magnolia.module.cache.executor.UseCache : Serving info.magnolia.module.cache.filter.InMemoryCachedEntry@890c07c[gzippedContent=660 bytes,plainContent=2432 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList=<null>,lastModificationTime=1597238980209,originalUrl=http://localhost:8080/dx-core-webapp/travel/main/00,timeToLiveInSeconds=-1]
2020-08-12 15:31:39,321 DEBUG info.magnolia.module.cache.filter.CacheFilter : Cache policy result: CachePolicyResult{behaviour=store, cacheName=defaultPageCache, cacheKey=DefaultCacheKey{uri='/home', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{}'}, cachedEntry=null}
2020-08-12 15:31:39,342 DEBUG magnolia.module.cache.cachepolicy.voters.TtlVoting: voter [browserTtlVoter] fired 2147483647
2020-08-12 15:31:39,342 DEBUG magnolia.module.cache.cachepolicy.voters.TtlVoting: voter [serverTtlVoter] fired 2147483647
2020-08-12 15:31:39,344 DEBUG info.magnolia.module.cache.executor.UseCache : Serving info.magnolia.module.cache.filter.InMemoryCachedEntry@151976c4[gzippedContent=534 bytes,plainContent=1153 bytes,contentType=text/html,characterEncoding=UTF-8,statusCode=200,serializableHeadersBackingList={Last-Modified=[1597239099321], Content-Type=[text/html]},lastModificationTime=1597239099321,originalUrl=http://localhost:8080/dx-core-webapp/home,timeToLiveInSeconds=-1]
2020-08-12 15:31:57,452 DEBUG info.magnolia.module.cache.filter.CacheFilter : Cache policy result: CachePolicyResult{behaviour=store, cacheName=sportstation, cacheKey=DefaultCacheKey{uri='/sportstation', serverName='localhost', locale='en', channel='all', params={}', secure='false', method='get', additionalAttributes='{}'}, cachedEntry=null}
2020-08-12 15:31:57,812 DEBUG magnolia.module.cache.cachepolicy.voters.TtlVoting: voter [browserTtlVoter] fired 2147483647
2020-08-12 15:31:57,812 DEBUG magnolia.module.cache.cachepolicy.voters.TtlVoting: voter [serverTtlVoter] fired 2147483647
It seems to me this is also tied to site definition as well, correct? I want to clarify that in the docs if true. |
| Comment by Roman Kovařík [ 12/Aug/20 ] |
|
You don't need to do 'contentCaching': 'defaultPageCache': 'travel': 'extends': '../defaultPageCache' Caches are created on the fly from the defaultPageCache if a specific config is not provided.
Yes it uses the path mapping from the site definition. You don't need to explicitly configure anything per site, just change the filter class and flush policy class. |
| Comment by Roman Kovařík [ 20/Aug/20 ] |
|
Something like patch.patch |
| Comment by Viet Nguyen [ 08/Jun/21 ] |
|
This work around from the code maybe the cause of the issue:
Fixing could be implement a ModulesStartedEvent.Handler so that cache module could be initialized after all modules started. Please mind the infinite loop in case you start the cache module again |