Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

fix(gateway): disable compression #2245

Merged
merged 1 commit into from
Jul 12, 2019
Merged

Conversation

lidel
Copy link
Member

@lidel lidel commented Jul 12, 2019

This PR supersedes #2227 as a fix for "random" daemon crashes with NodeError: Cannot call write after a stream was destroyed (details in libp2p/js-libp2p#374).

Steps to reproduce: libp2p/js-libp2p#374 (comment)

@alanshaw confirmed the underlying error was not specific to buffer-peek-stream, but caused by the way Hapi handles pipelines with multiple PassThrough/Transform/pipe calls. We had two Transforms: one for content-type sniffing, and one for streaming compression.

Turns out go-ipfs does not compress anything by default, so we can remove PassThrough responsible for streaming of compressed payload and fix the issue while keeping optimization introduced by buffer-peek-stream (bit better than #2227 because gateway does not hit datastore twice).

Closes libp2p/js-libp2p#374
Closes libp2p/pull-mplex#13
Closes #2227

This is an alternative to #2227
that does not hit datastore twice.

The underlying error was caused by multiple PassThrough/pipe calls.
Turns out go-ipfs does not compress anything by default, so we can
remove PassThrough responsible for streaming of compressed payload
and fix the issue while keeping optimization introduced by buffer-peek-stream.

Closes libp2p/js-libp2p#374
Closes libp2p/pull-mplex#13

License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org>
@alanshaw alanshaw merged commit 4ee28e0 into master Jul 12, 2019
@alanshaw alanshaw deleted the fix/not-http-compression branch July 12, 2019 15:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot call write after a stream was destroyed Cannot call write after a stream was destroyed
3 participants