Skip to content

Conversation

@ejona86
Copy link
Member

@ejona86 ejona86 commented Jan 26, 2026

Background

In the gRPC servlet transport with Tomcat 10 Embedded,
we observed occasional flaky tests in grpc-servlet-jakarta:tomcat10Test.
The issue is related to a race condition where the OutputBuffer is prematurely recycled during asynchronous writes.

Changes

Reference: spring-projects/spring-boot#36763 (comment)

This PR explicitly calls .setDiscardFacades(false) on the Tomcat 10 Embedded Connector.
The intention is to prevent outputBuffer reuse, so that the above race condition does not occur during tests.

Purpose

  • Reduce the likelihood of flaky tests in grpc-servlet-jakarta:tomcat10Test
  • Apply the method suggested in the referenced Spring Boot discussion

Note

This change aligns Tomcat 10 Embedded behavior with Tomcat 9 (where RECYCLE_FACADES defaults to false), and is known to prevent premature OutputBuffer recycling during async writes.
Based on the investigation and prior reports (e.g., Spring Boot discussion),
this is currently the correct and safe configuration for servlet-based asynchronous responses in Tomcat 10.

Fixes #12524

Backport of #12530

Set discardFacades=false in Tomcat 10 Embedded to avoid premature
OutputBuffer recycling. This works around flaky tests in gRPC servlet
transport by ensuring facades are not discarded too early.

Fixes grpc#12524
@ejona86 ejona86 requested a review from kannanjgithub January 26, 2026 23:33
@ejona86 ejona86 merged commit 28db3fc into grpc:v1.76.x Jan 27, 2026
16 of 17 checks passed
@ejona86 ejona86 deleted the backport-servlet/fix-flaky-recycle-1.76 branch January 27, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants