Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caching empty containers in the Velocity2 cache when accessing in a language where the content doesn't exist #22534

Closed
swicken-dotcms opened this issue Jul 7, 2022 · 3 comments · Fixed by #26036
Assignees

Comments

@swicken-dotcms
Copy link
Contributor

swicken-dotcms commented Jul 7, 2022

Describe the bug
If you access a page in a language where the page and the content in the page both do not exist we are caching the empty container in the Velocity2 cache

Reproduced on: 21.06, 22.06

Related Ticket: https://dotcms.zendesk.com/agent/tickets/107703

To Reproduce
The environment must be configured with the defaults for the two following variables:

DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE=false
DEFAULT_PAGE_TO_DEFAULT_LANGUAGE=true

  1. From the demo starter, create a page called 'test-page' in the root in English
  2. Add a new Rich Text contentlet to the container on that page in English
    NOTE: Do not add Spanish versions of either the page or the content
  3. Clear the cache
  4. In another browser/incognito, go to http://localhost:8080/test-page?language_id=2, you will correctly see an empty container
  5. Now go to http://localhost:8080/test-page?language_id=1 and you will incorrectly see an empty container
  6. Clear the Velocity2 cache and revisit http://localhost:8080/test-page?language_id=1, the Rich Text will properly display

It appears we are caching the alternate language versions of content into the fallback default page containers in the Velocity2 cache

Expected behavior
When falling back we should not cache the content into the default language container

Additional context
This only occurs when we fall back the page and not the content. If the page exists in both languages but the content does not, it is cached correctly.
It als only occurs if the non-existent language is accessed before the default, otherwise the default language gets properly cached.

WORKAROUNDS
Create a version of the page in all languages
Set DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE to true

@stale
Copy link

stale bot commented Dec 1, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 1, 2022
@stale stale bot closed this as completed Dec 8, 2022
@swicken-dotcms swicken-dotcms added OKR : Customer Support Owned by Scott and removed stale labels Sep 8, 2023
@wezell wezell reopened this Sep 8, 2023
wezell added a commit that referenced this issue Sep 8, 2023
…g the site in, that the pages will be cached separately.

ref: #22534
wezell added a commit that referenced this issue Sep 8, 2023
…g the site in, that the pages will be cached separately.

ref: #22534
@wezell wezell added the LTS: Needs Backport Ticket that will be added to LTS label Sep 8, 2023
wezell added a commit that referenced this issue Sep 11, 2023
wezell added a commit that referenced this issue Sep 11, 2023
wezell added a commit that referenced this issue Sep 11, 2023
@jcastro-dotcms jcastro-dotcms self-assigned this Sep 11, 2023
@jcastro-dotcms jcastro-dotcms moved this from New to Current Sprint Backlog in dotCMS - Product Planning Sep 11, 2023
@jcastro-dotcms jcastro-dotcms moved this from Current Sprint Backlog to In Review in dotCMS - Product Planning Sep 13, 2023
@github-project-automation github-project-automation bot moved this from In Review to Done in dotCMS - Product Planning Sep 14, 2023
fmontes pushed a commit that referenced this issue Sep 14, 2023
#26036)

* fix(velocity): this ensures that whatever language the user is viewing the site in, that the pages will be cached separately.

ref: #22534

* fix(velocity): this ensures that whatever language the user is viewing the site in, that the pages will be cached separately.

ref: #22534

* fix: invalid page cache #22534

* fix: invalid page cache #22534

* fix: invalid page cache #22534

* CR Feedback: Using Lazy objects for reading configuration properties.

* Implementing SonarQube feedback.

---------

Co-authored-by: Jose Castro <[email protected]>
@github-project-automation github-project-automation bot moved this from Done to Current Sprint Backlog in dotCMS - Product Planning Sep 14, 2023
@jcastro-dotcms
Copy link
Contributor

INTERNAL QA: PASSED

After following the STR provided by @swicken-dotcms , this is what is happening after the code fix:

@jcastro-dotcms jcastro-dotcms moved this from Current Sprint Backlog to QA - Backlog in dotCMS - Product Planning Sep 14, 2023
@bryanboza bryanboza moved this from QA - Backlog to QA - In Progress in dotCMS - Product Planning Sep 14, 2023
@jcastro-dotcms jcastro-dotcms moved this from QA - In Progress to QA - Backlog in dotCMS - Product Planning Sep 18, 2023
@jcastro-dotcms jcastro-dotcms moved this from QA - Backlog to QA - In Progress in dotCMS - Product Planning Sep 18, 2023
@josemejias11
Copy link
Contributor

Approved: Tested on master_7713bff_SNAPSHOT, Docker, macOS 13.0, FF v113.0

@josemejias11 josemejias11 moved this from QA - In Progress to Done in dotCMS - Product Planning Sep 18, 2023
@erickgonzalez erickgonzalez added Next LTS Release and removed LTS: Needs Backport Ticket that will be added to LTS labels Nov 10, 2023
erickgonzalez added a commit that referenced this issue Nov 14, 2023
@erickgonzalez erickgonzalez added Release : 23.01.9 Included in LTS patch release 23.01.9 and removed Next LTS Release labels Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

7 participants