Skip to content

fix(flate encoder): do not mark internal state as flushed if we ran out of buffer space #333

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

Merged
merged 1 commit into from
Mar 15, 2025

Conversation

link2xt
Copy link
Contributor

@link2xt link2xt commented Mar 14, 2025

There may be data remaining in the internal state of the encoder.

Without the fix on a second call to flush() when the caller makes space in the output buffer we will write nothing into the buffer.

@link2xt
Copy link
Contributor Author

link2xt commented Mar 14, 2025

This bug was encountered in chatmail/core#6656 when uploading a large message over IMAP with IMAP COMPRESS extension. Writer pushed the message into encoder, but then only one output buffer makes it to the server after flush() and subsequent flush calls do nothing.

Copy link
Collaborator

@NobodyXu NobodyXu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! LGTM

@NobodyXu NobodyXu added this pull request to the merge queue Mar 15, 2025
Merged via the queue into Nullus157:main with commit 6e68abe Mar 15, 2025
17 checks passed
Copy link

codecov bot commented Mar 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 0.00%. Comparing base (f3e9742) to head (a21d8a2).
Report is 6 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff     @@
##   main   #333   +/-   ##
===========================
===========================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

link2xt added a commit to chatmail/core that referenced this pull request Mar 15, 2025
…stuck

async-compression 0.4.21 fixes a bug in the encoder
where it did not flush all the internal state sometimes,
resulting in IMAP APPEND command timing out
waiting for response when uploading large sync messages.

See <Nullus157/async-compression#333>
for details.
link2xt added a commit to chatmail/core that referenced this pull request Mar 15, 2025
…stuck

async-compression 0.4.21 fixes a bug in the encoder
where it did not flush all the internal state sometimes,
resulting in IMAP APPEND command timing out
waiting for response when uploading large sync messages.

See <Nullus157/async-compression#333>
for details.
@r10s
Copy link

r10s commented Mar 15, 2025

@link2xt thanks a lot for diving into that sea of code and delendencies 🤿 for finding and and for fixing the bug ❤️

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