Skip to content
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

Bugfix: Correct minimum required bounds for serializing cstring and cstringUtf8 #538

Merged
merged 1 commit into from
Aug 11, 2022

Conversation

alexbiehl
Copy link
Member

@alexbiehl alexbiehl commented Aug 9, 2022

I think this was an oversight in 155bf8a

The bufferFull signal takes the minimum number of required space to make progress. Instead, the defaultChunkSize was used. I can't prove it yet but I have a hunch this is causing yesodweb/wai#894. It looks like defaultChunkSize is 32k. A Warp buffer is something around 16k thus it will always hit the bufferFull signal when writing a cstring/cstringUtf8 requiring a bigger buffer which then makes Warp error out.

Pinging @bgamari as he is the author of the aforementioned patch and @basvandijk, maybe you can try out this fix and see whether it's fixing your issue?

@alexbiehl alexbiehl changed the title Correct minimum required bounds for serializing cstring and cstringUtf8 Bugfix: Correct minimum required bounds for serializing cstring and cstringUtf8 Aug 9, 2022
Copy link
Member

@sjakobi sjakobi left a comment

Choose a reason for hiding this comment

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

I'm not very familiar with the Builder internals at this stage, but I think this fix is in line with the bufferFull haddocks and the other uses of bufferFull in this repo.

It would be great to get confirmation that this fixes yesodweb/wai#894 though.

Data/ByteString/Builder/Prim.hs Show resolved Hide resolved
@Bodigrim
Copy link
Contributor

Bodigrim commented Aug 9, 2022

Makes sense to me. @basvandijk any chance you can give this patch a spin please?

@Bodigrim Bodigrim added this to the 0.11.4.0 milestone Aug 10, 2022
@Bodigrim Bodigrim requested a review from sjakobi August 10, 2022 19:50
@Bodigrim Bodigrim merged commit 6299fe0 into haskell:master Aug 11, 2022
@alexbiehl alexbiehl deleted the alex/min-bounds branch August 12, 2022 08:24
Bodigrim pushed a commit to Bodigrim/bytestring that referenced this pull request Nov 25, 2022
angerman added a commit to angerman/nix-serve-ng that referenced this pull request Dec 7, 2022
This fixes aristanetworks#19 by downgrading the compiler to 8.10 (I still don't think 9.0 should be used in production).
bytestring < 0.11.4 (which as of today has not been released to https://hackage.haskell.org/package/bytestring),
is broken, as per haskell/bytestring#538. This in turn shows up in yesodweb/wai#894, and ultimately causes aristanetworks#19.
@domenkozar
Copy link

Any chance we get a release out with this bug fix?

clyring added a commit that referenced this pull request Dec 31, 2022
Bodigrim pushed a commit that referenced this pull request Jan 8, 2023
* Update changelog for v0.11.4.0

Co-authored-by: Matthew Craven <clyring@gmail.com>

* Organize changelog entries for 0.11.4.0

* Re-phrase changelog entry for #538

Co-authored-by: Matthew Craven <clyring@gmail.com>
clyring pushed a commit that referenced this pull request Jan 10, 2023
* Update changelog for v0.11.4.0

Co-authored-by: Matthew Craven <clyring@gmail.com>

* Organize changelog entries for 0.11.4.0

* Re-phrase changelog entry for #538

Co-authored-by: Matthew Craven <clyring@gmail.com>

(cherry picked from commit 0602eab)
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.

None yet

5 participants