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

BrokenPipeError: [Errno 32] Broken pipe #62

Open
ufilme opened this issue Sep 4, 2019 · 4 comments
Open

BrokenPipeError: [Errno 32] Broken pipe #62

ufilme opened this issue Sep 4, 2019 · 4 comments

Comments

@ufilme
Copy link

ufilme commented Sep 4, 2019

When trying to upload a big file this happened

Error

Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/requests/packages/urllib3/connectionpool.py", line 595, in urlopen
    chunked=chunked)
  File "/home/pi/.local/lib/python3.7/site-packages/requests/packages/urllib3/connectionpool.py", line 363, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.7/http/client.py", line 1229, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1275, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1224, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1055, in _send_output
    self.send(chunk)
  File "/usr/lib/python3.7/http/client.py", line 977, in send
    self.sock.sendall(data)
  File "/usr/lib/python3.7/ssl.py", line 1015, in sendall
    v = self.send(byte_view[count:])
  File "/usr/lib/python3.7/ssl.py", line 984, in send
    return self._sslobj.write(data)
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/requests/adapters.py", line 423, in send
    timeout=timeout
  File "/home/pi/.local/lib/python3.7/site-packages/requests/packages/urllib3/connectionpool.py", line 640, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/home/pi/.local/lib/python3.7/site-packages/requests/packages/urllib3/util/retry.py", line 261, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/home/pi/.local/lib/python3.7/site-packages/requests/packages/urllib3/packages/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/home/pi/.local/lib/python3.7/site-packages/requests/packages/urllib3/connectionpool.py", line 595, in urlopen
    chunked=chunked)
  File "/home/pi/.local/lib/python3.7/site-packages/requests/packages/urllib3/connectionpool.py", line 363, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/lib/python3.7/http/client.py", line 1229, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1275, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1224, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.7/http/client.py", line 1055, in _send_output
    self.send(chunk)
  File "/usr/lib/python3.7/http/client.py", line 977, in send
    self.sock.sendall(data)
  File "/usr/lib/python3.7/ssl.py", line 1015, in sendall
    v = self.send(byte_view[count:])
  File "/usr/lib/python3.7/ssl.py", line 984, in send
    return self._sslobj.write(data)
requests.packages.urllib3.exceptions.ProtocolError: ('Connection aborted.', BrokenPipeError(32, 'Broken pipe'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "up.py", line 23, in <module>
    upload = client.uploads('***********').create(filePath)
  File "/usr/local/lib/python3.7/dist-packages/contentful_management/uploads_proxy.py", line 52, in create
    file_upload=True
  File "/usr/local/lib/python3.7/dist-packages/contentful_management/client.py", line 781, in _post
    return self._request('post', url, attributes, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/contentful_management/client.py", line 748, in _request
    response = retry_request(self)(request_method)(url, query_or_data, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/contentful_management/utils.py", line 224, in wrapper
    return http_call(url, query, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/contentful_management/client.py", line 719, in _http_post
    return self._http_request('post', url, kwargs)
  File "/usr/local/lib/python3.7/dist-packages/contentful_management/client.py", line 691, in _http_request
    response = request_method(request_url, **kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/requests/api.py", line 110, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/requests/api.py", line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/requests/sessions.py", line 596, in send
    r = adapter.send(request, **kwargs)
  File "/home/pi/.local/lib/python3.7/site-packages/requests/adapters.py", line 473, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', BrokenPipeError(32, 'Broken pipe'))

Code

from contentful_management import Client

filePath = "/path/to/file"
fileName = "Foo"

client = Client('*****************************************')

upload = client.uploads('********************').create(filePath)
id_upload = upload.id

asset_id = 'None'
asset = client.assets('**********************', 'master').create(asset_id, {
    "fields": {
      "title": {
          "en-US": fileName
      },
      "file": {
          "en-US": {
              "contentType": "video/mkv",
              "fileName": fileName,
              "uploadFrom": {
                  "sys": {
                    "type": "Link",
                    "linkType": "Upload",
                    "id": id_upload
                  }
              }
          }
      }
  }
})

asset.process()
@dlitvakb
Copy link
Contributor

dlitvakb commented Sep 4, 2019

Hey @pippognetow,

Looks like your connection may have closed prematurely, please try again later and let me know if the problem persists.

Can you also try running this from a different machine/server? And let me know if the problem also appears there?

Cheers

@ufilme
Copy link
Author

ufilme commented Sep 4, 2019

I'm fighting this problem from yesterday and today it happened again.

I tried also with smaller files:
~ 100 MB
~ 300 MB
~ 1,5 GB
But the file I need to upload is ~8 GB.

Unfortunately I cannot try on a different server because I don't have one with that space.

@tw127
Copy link

tw127 commented Mar 30, 2020

I'm having this same issue. I have tried it connecting to 2 different servers and one server operates fine - the other fails always with the errors above.
uploading differing sizes of files also results in failures on the connection to one server.

@WhymustIhaveaname
Copy link

I have the same problem. This error happens when the network is unstable, and the connection breaks accidentally. This problem causes my server stuck repeatedly. What a pain in the neck!
And now I decide to use PHP instead.

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

No branches or pull requests

4 participants