Skip to content

Interrupt work of TextFormat::Printer on `io::ZeroCopyOutputStream:…#26508

Open
kpavlov00 wants to merge 1 commit intoprotocolbuffers:mainfrom
kpavlov00:TextFormat-Printer-Print-interrupt-on-ZeroCopyOutputStream-Next-false
Open

Interrupt work of TextFormat::Printer on `io::ZeroCopyOutputStream:…#26508
kpavlov00 wants to merge 1 commit intoprotocolbuffers:mainfrom
kpavlov00:TextFormat-Printer-Print-interrupt-on-ZeroCopyOutputStream-Next-false

Conversation

@kpavlov00
Copy link
Copy Markdown
Contributor

…:Next` fail

@kpavlov00
Copy link
Copy Markdown
Contributor Author

kpavlov00 commented Mar 21, 2026

Relates: #23288

@kpavlov00 kpavlov00 force-pushed the TextFormat-Printer-Print-interrupt-on-ZeroCopyOutputStream-Next-false branch from 33bc836 to bd88d7a Compare March 23, 2026 08:43
@kpavlov00
Copy link
Copy Markdown
Contributor Author

kpavlov00 commented Mar 23, 2026

Style nit: several new if (generator->Failed()) blocks use extra indentation versus the surrounding 2-space blocks in text_format.cc.

@themavik thank you, style fixed

@esrauchg esrauchg added the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Mar 24, 2026
@github-actions github-actions Bot removed the 🅰️ safe for tests Mark a commit as safe to run presubmits over label Mar 24, 2026
@karenwuz karenwuz requested a review from esrauchg April 8, 2026 16:26
@kpavlov00
Copy link
Copy Markdown
Contributor Author

@esrauchg Hello, I just wonder is everything ok with this PR?
It is very important for our project
thanks

@esrauchg
Copy link
Copy Markdown
Contributor

Sorry about the delay getting back to you.

I looked at the PR with @sbenzaquen and I think that the narrow shape of the change doesn't look like something like something we can accept as is (a number of invasive if's at arbitrary points, especially without test coverage).

And I'm not sure locally if it can easily be made super clean here.

Can you actually speak a bit more for the importance of the behavior for your business usecase, why is failed-printing something that you are hitting often enough to be a topic of concern for optimizing?

Thanks!

@kpavlov00
Copy link
Copy Markdown
Contributor Author

kpavlov00 commented Apr 14, 2026

@esrauchg Thank you for the answer

In most of our services, we use TextFormat::Printer::Print to log requests/responses,
and we passing io::ArrayOutputStream of limited size to it.

Since the capacity of Output is limited, we want to have a limited execution time.

However, the current implementation doesn't have the ability to interrupt its execution.

Small deviations can be considered non-critical,
but interrupting and not continuing to the end of the message if its size is significantly larger than the Output capacity becomes performance critical.

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.

2 participants