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

multiple file uploads to RPC timeout when using nginx proxy #5755

Open
pbostrom opened this issue Nov 8, 2018 · 2 comments
Open

multiple file uploads to RPC timeout when using nginx proxy #5755

pbostrom opened this issue Nov 8, 2018 · 2 comments
Labels
kind/bug A bug in existing code (including security flaws)

Comments

@pbostrom
Copy link

pbostrom commented Nov 8, 2018

Version information:

go-ipfs version: 0.4.18-aefc746
Repo version: 7
System version: amd64/linux
Golang version: go1.11.1

Client: js-ipfs-api 26.1.2 running in node.

Type:

Bug

Description:

I'm having an issue uploading multiple files via the IPFS RPC when using an nginx reverse proxy. I am using the JS library js-ipfs-api in node. If I upload directly to port 5001 it works fine, but when I add the nginx proxy I get a timeout from the IPFS RPC. Ultimately my motivation is to use the nginx proxy for authentication to the IPFS RPC.

A few notes: I can upload multiple small files, but I start running into this issue when I have a couple files in the 5-7MB range. I am able to upload these files individually however.

I have created a repo to reproduce: https://github.com/pbostrom/ipfs_testcase
Install docker/docker-compose and run:

git clone https://github.com/pbostrom/ipfs_testcase.git
cd ipfs_testcase
sudo docker-compose up -d
sudo docker run -it --network ipfs_testcase_proxy-tier pbostrom/ipfs_testcase

This will twice attempt to upload 3 files: the first attempt directly to the RPC service on port 5001, the second attempt will go through the nginx reverse proxy. The second attempt should stall and nginx will eventually timeout. nginx logs:

2018/11/08 18:54:09 [error] 6#6: *1 upstream timed out (110: Connection timed out) while reading upstream, client: 172.18.0.4, server: , request: "POST /api/v0/add?recursive=true&stream-channels=true HTTP/1.1", upstream: "http://172.18.0.2:5001/api/v0/add?recursive=true&stream-channels=true", host: "nginx"
172.18.0.4 - - [08/Nov/2018:18:54:09 +0000] "POST /api/v0/add?recursive=true&stream-channels=true HTTP/1.1" 200 0 "-" "/node-ipfs-api/26.1.2/"

This may be related to #5168 but I do not see the error http: invalid Read on closed Body in any of the logs or responses.

@eingenito
Copy link
Contributor

@pbostrom thanks for the report and the awesome work to make reproducing the bug easy. I was despairing a little when I read the issue title. We'll take a look!

@eingenito
Copy link
Contributor

So, confirmed, and also not fixed by ipfs/go-ipfs-cmds#116. I'll look into it further.

@eingenito eingenito added the kind/bug A bug in existing code (including security flaws) label Nov 10, 2018
@eingenito eingenito self-assigned this Nov 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws)
Projects
None yet
Development

No branches or pull requests

2 participants