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

Strange intermittent HTML rendering behaviour #939

Open
tadam313 opened this issue Jan 11, 2023 · 1 comment
Open

Strange intermittent HTML rendering behaviour #939

tadam313 opened this issue Jan 11, 2023 · 1 comment

Comments

@tadam313
Copy link

tadam313 commented Jan 11, 2023

We've observed a very strange and intermittent behaviour of Thymeleaf template engine while we're rendering HTML templates at some of our Spring services. We use autowired SpringTemplateEngine directly to process the template files in web controller and SQS message listeners (in highly concurrent manner). To demonstrate the issue: (left out some part to highlight the problem)

Original template

<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"/><head>... <img class="logo" src="styles/logo.png" alt="Test logo"/>...<td class="summary">...

Rendered

<!DOCTYPE html><html lang="en"><head><meta charset=UTF-8/></head>... <img class="logo" src="styles/logo.png" alt=Test logo/>...<td class=summary>...

Problem is it sometimes omit the quotes of attributes while leave the rest untouched. This is quite an severe for us since we're using the rendered template as an input of further processing which expects well formatted XHTML files thus result in failure. Unfortunately we've tried to reproduce this consistently but couldn't... we merely observe this intermittently as part of our deployed system. We decided to report this as it might surface an underlying issue...

Do you have any idea what may have caused this behaviour to sometime omit quotes from certain HTML attributes?

Environment:

Thymeleaf version (using org.springframework.boot:spring-boot-starter-thymeleaf:2.7.7)

  • org.thymeleaf:thymeleaf:3.0.15.RELEASE
  • org.thymeleaf:thymeleaf-spring5:3.0.15.RELEASE
  • org.thymeleaf.extras:thymeleaf-extras-java8time:3.0.4.RELEASE

Spring boot version: 2.7.7

Runtime:

  • ibm-semeru-runtimes:open-17.0.5_8-jre-focal

Workaround:

After we restart the service it helps presumably due to the eviction of template cache.

@danielfernandez
Copy link
Member

There is nothing in Thymeleaf's code that indicates high concurrency could affect how an attribute that is not even processed ends up being quoted/unquoted at the final result. I would ask to re-verify that the original template is not the one that actually changes.

A sample project demonstrating this issue would be needed for further diagnostic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants