Repository navigation
fix: update Jackson to 3.2.4 and Spring to 7.0.9, flush async responses - #1714
Conversation
Updates Jackson and Spring to current patch releases, and fixes the async response hang that newer Spring versions cause. Dependency changes: - Jackson 3.0.2 -> 3.2.4. jackson.version moves from core to the parent pom so springboot4 can align on it. - spring module: Spring Framework 7.0.0 -> 7.0.9, Spring Security 7.0.0 -> 7.0.7. The spring archetype gets 7.0.9 in pom.xml and build.gradle. - springboot4: Spring Boot 4.0.0 -> 4.0.8, Spring Framework 7.0.1 -> 7.0.9, Spring Security 7.0.0 -> 7.0.7, Spring Cloud Function 5.0.0 -> 5.0.4. Imports jackson-bom at core's version and pins slf4j-api and jspecify so dependencyConvergence passes. - springboot4 archetype: Boot parent 4.0.8 with jackson-bom.version and jackson-2-bom.version overrides (Jackson 3.2 needs annotations 2.22). - slf4j 2.0.17 -> 2.0.18 to match Boot. Async fix: Since Spring Framework 7.0.6, ServletServerHttpResponse.getBody() returns a stream that ignores flush() unless spring.http.response.flush.enabled is set. We relied on that flush to commit the response after an async re-dispatch, and doFilter skips its own flush for ASYNC requests, so a DeferredResult endpoint never released the response latch. doFilter now flushes after the re-dispatch unless the dispatch target started a new async cycle. AsyncAppTest gets a 30 second timeout so a regression fails instead of hanging the build.
Can we make an issue for this to track? |
| import org.junit.jupiter.api.Timeout; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertEquals; | ||
| import static org.junit.jupiter.api.Assertions.fail; |
There was a problem hiding this comment.
can we add a test with a servlet that starts async and dispatches, asserting the response gets flushed?
Adds two AwsAsyncContextTest cases that run the real doFilter with a plain servlet behaving like Spring MVC 7.0.6+: it starts async and dispatches on the first pass, then writes the body without flushing on the async dispatch. One asserts the container commits the response and releases the latch; the other asserts the response stays open when the dispatch starts a new async cycle. The first fails without the doFilter flush change.
Good call, opened #1715. It only affects local runs (a stale archetype can make it pass) and the CI error message. Releases run the archetype Integration Tests through plain Maven, so they aren't affected. |
Updates Jackson and Spring to current patch releases, and fixes the async response hang that newer Spring versions cause. The Dependabot PRs couldn't go in on their own: the springboot4 job fails dependency convergence on each of them, and the Spring jobs hang until the 6 hour timeout.
Dependency changes
Async fix
Since Spring Framework 7.0.6, ServletServerHttpResponse.getBody() returns a stream that ignores flush() unless spring.http.response.flush.enabled is set. We relied on that flush to commit the response after an async re-dispatch, and doFilter skips its own flush for ASYNC requests, so a DeferredResult endpoint never released the response latch. doFilter now flushes after the re-dispatch unless the dispatch target started a new async cycle, which is what a servlet container does. On Spring versions before 7.0.6 the response is already committed by then, so nothing changes there.
AsyncAppTest gets a 30 second timeout so a regression fails the build instead of holding a runner for 6 hours.
Notes for the release
Supersedes #1656, #1701, #1705 and #1706, and the library and archetype parts of #1636, #1641 and #1711. Their samples/ changes and #1702 are left to Dependabot.
Testing
Note: gha_build.sh doesn't check the exit code of the archetype's own mvn install. On a machine with an older archetype installed, a failing archetype integration test still reports success, because the next step generates from the old archetype. On CI it fails, but one step later with "The desired archetype does not exist". That's how the jackson-annotations problem nearly got past local testing. Releases aren't affected. Tracked in #1715.