Skip to content

Bump minimum and target version and drop Connection: close header when possible #189

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

Closed
wants to merge 3 commits into from

Conversation

ntninja
Copy link
Contributor

@ntninja ntninja commented Jul 11, 2019

No description provided.

@machawk1
Copy link
Contributor

@Alexander255:
I re-tested this with regard to the issue in #187.

code:

import ipfshttpclient
import os

bytes = bytearray(os.urandom(100000))

IPFS_API = ipfshttpclient.Client(f"/dns/localhost/tcp/5001/http")
res1 = IPFS_API.add_bytes(bytes)
res2 = IPFS_API.add_bytes(bytes)

Python 3.7.3
c4f45b3 per ^

with go-ipfs 0.4.19:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 472, in send
    low_conn.send(i)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 977, in send
    self.sock.sendall(data)
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/private/tmp/py-ipfs-api/ipfshttpclient/http.py", line 255, in _do_request
    return requests.request(*args, **kwargs)
  File "/private/tmp/py-ipfs-api/ipfshttpclient/requests_wrapper.py", line 244, in request
    return session.request(method=method, url=url, **kwargs)
  File "/private/tmp/py-ipfs-api/ipfshttpclient/requests_wrapper.py", line 223, in request
    return super(Session, self).request(method, url, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: [Errno 32] Broken pipe

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "test.py", line 8, in <module>
    res2 = IPFS_API.add_bytes(bytes)
  File "/private/tmp/py-ipfs-api/ipfshttpclient/utils.py", line 142, in wrapper
    res = cmd(*args, **kwargs)
  File "/private/tmp/py-ipfs-api/ipfshttpclient/client/base.py", line 15, in wrapper
    result = func(*args, **kwargs)
  File "/private/tmp/py-ipfs-api/ipfshttpclient/client/__init__.py", line 231, in add_bytes
    data=body, headers=headers, **kwargs)
  File "/private/tmp/py-ipfs-api/ipfshttpclient/http.py", line 50, in wrapper
    return func(self, *args, **merged)
  File "/private/tmp/py-ipfs-api/ipfshttpclient/http.py", line 379, in request
    files, headers, data, timeout=timeout)
  File "/private/tmp/py-ipfs-api/ipfshttpclient/http.py", line 297, in _request
    timeout=timeout)
  File "/private/tmp/py-ipfs-api/ipfshttpclient/http.py", line 259, in _do_request
    six.raise_from(exceptions.ConnectionError(error), error)
  File "<string>", line 3, in raise_from
ipfshttpclient.exceptions.ConnectionError: ConnectionError: [Errno 32] Broken pipe

with go-ipfs 0.4.21:
No output, indicative of completion without exceptions per above code.

This leads me to believe that go-ipfs 0.4.19 is not yet fully supported by the latest commit in the PR. c4f45b3 states "We strive to support the last 5 releases of go-IPFS". py-ipfs-api (before the overhaul) worked with go-ipfs 0.4.19 before the ipfs-http-client overhaul.

@machawk1
Copy link
Contributor

A solution: start anew with supporting go-ipfs 0.4.21 and a rolling 5 versions forward. Alternatively, continue tweaking py-ipfs-http-client until it works with go-ipfs 0.4.17-0.4.19, as c4f45b3 states. I have yet to test with go-ipfs 0.4.17 and 0.4.18 due to necessary changes to the client initialization in the above code (I'm short on cycles at the moment).

@ntninja
Copy link
Contributor Author

ntninja commented Apr 16, 2020

This will be superseded based on the suggestions in the last comment.

@ntninja ntninja closed this Apr 16, 2020
@ntninja ntninja mentioned this pull request Apr 16, 2020
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