question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow delaying first output until processing completely finishes

See original GitHub issue

Streamlined execution flow causes a partially rendered template containing the error page with HTTP status code 200 on exceptions at view layer. This behavior is nonsatisfying for such a common use-case.

The servlet dispatcher should forward to the error page with HTTP status code 500 as it was the case in Thymeleaf < 3 already.

Based on the discussion here you need to write your own implementation of ITemplateEngine when using Thymeleaf in conjunction with Spring MVC which is an ugly workaround.

Maybe putting a flag into SpringTemplateEngine to make it configurable could be a better solution.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:12
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
danielfernandezcommented, Oct 9, 2018

This has been implemented by means of a flag called producePartialOutputWhileProcessing, with default value true, that can be configured with its corresponding setter and getter method both at the ThymeleafViewResolver (for an application-wide setting) and at ThymeleafView objects (for template-specific setting).

When set to false, Thymeleaf will buffer the entire produced output until processing completely finishes and only then output it as a single chunk to the web server’s output buffers.

First (very informal) tests with very large HTML documents show no significative difference in time-to-last-result times with concurrent load = 1, but obviously huge differences in time-to-first-result times and memory consumption, so this should turn the web server very sensitive to increases in concurrent load.

1reaction
odrotbohmcommented, Oct 8, 2018

I am not even arguing which one is better and am fine with Thymeleaf defaulting to streaming and having a strong opinion that this is the better approach. All I’m arguing is, that there should be an easy way to get back to the “old mode” of exception handling (i.e. exceptions trigger a forward to the error page under all circumstances) as that allows users to decouple both problems: if they were fine with in-memory rendering on TL2, they probably are with TL3 for a start. People starting with Thymeleaf 3 don’t have to be bothered with this. But migrations could now move to TL3 first and then spend dedicated time to tackle this problem. As it stands today, projects running into this problem will have a hard time to move to TL3 (or Spring Boot 2.0 transitively) at all.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Proper way to wait for one function to finish before continuing?
For the second function, you can use async/await a function where you will await for the first function to complete before proceeding with...
Read more >
Operating Systems: CPU Scheduling
A scheduling system allows one process to use the CPU while another is waiting for I/O, thereby making full use of otherwise lost...
Read more >
Coding Timers and Delays in Arduino : 8 Steps - Instructables
1. Here is how NOT to code a delay in a sketch. int led = 13;bool ledOn; void setup() { Serial.begin(9600); pinMode(led, OUTPUT); // initialize the digital...
Read more >
Foreground and background processing—ArcMap
You will notice a brief delay on the first tool execution as the background process is started.
Read more >
Python sleep(): How to Add Time Delays to Your Code
There are two ways to do this: Use time.sleep() as before. Use Event.wait() from the threading module. Let's ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found