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

'Connection aborted.', RemoteDisconnected('Remote end closed connection without response' when uploading large file #2712

Closed
Breezewrf opened this issue Nov 1, 2023 · 3 comments

Comments

@Breezewrf
Copy link

Description of the problem, including code/CLI snippet

I exec the following code to upload a file to gitlab deployed on local.

f = project.files.create({'file_path': destination_path,
                                'branch': "main",
                                'content': file_content_base64,
                                'author_email': 'test@example.com',
                                'author_name': 'wrf',
                                'commit_message': description,
                                'encoding': 'base64'},
                                timeout=100000000)
    print('File uploaded successfully.')

The smaller file is tested successfully but error comes when uploading large file (>500MB).
I have tried to set some timeout parameters, keep-alive and connection in header, but does not work.

Expected Behavior

Expected to upload successfully.

Actual Behavior

Traceback (most recent call last):
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/urllib3/connectionpool.py", line 791, in urlopen
    response = self._make_request(
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/urllib3/connectionpool.py", line 537, in _make_request
    response = conn.getresponse()
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/urllib3/connection.py", line 461, in getresponse
    httplib_response = super().getresponse()
  File "/home/lscm/.conda/envs/restful/lib/python3.9/http/client.py", line 1378, in getresponse
    response.begin()
  File "/home/lscm/.conda/envs/restful/lib/python3.9/http/client.py", line 320, in begin
    version, status, reason = self._read_status()
  File "/home/lscm/.conda/envs/restful/lib/python3.9/http/client.py", line 289, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/requests/adapters.py", line 487, in send
    resp = conn.urlopen(
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/urllib3/connectionpool.py", line 845, in urlopen
    retries = retries.increment(
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/urllib3/util/retry.py", line 470, in increment
    raise reraise(type(error), error, _stacktrace)
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/urllib3/util/util.py", line 38, in reraise
    raise value.with_traceback(tb)
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/urllib3/connectionpool.py", line 791, in urlopen
    response = self._make_request(
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/urllib3/connectionpool.py", line 537, in _make_request
    response = conn.getresponse()
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/urllib3/connection.py", line 461, in getresponse
    httplib_response = super().getresponse()
  File "/home/lscm/.conda/envs/restful/lib/python3.9/http/client.py", line 1378, in getresponse
    response.begin()
  File "/home/lscm/.conda/envs/restful/lib/python3.9/http/client.py", line 320, in begin
    version, status, reason = self._read_status()
  File "/home/lscm/.conda/envs/restful/lib/python3.9/http/client.py", line 289, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/uvicorn/protocols/http/h11_impl.py", line 408, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
    return await self.app(scope, receive, send)
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/fastapi/applications.py", line 292, in __call__
    await super().__call__(scope, receive, send)
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/starlette/applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/starlette/middleware/errors.py", line 184, in __call__
    raise exc
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/starlette/middleware/errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
    raise exc
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 20, in __call__
    raise e
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/fastapi/middleware/asyncexitstack.py", line 17, in __call__
    await self.app(scope, receive, send)
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/starlette/routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/starlette/routing.py", line 276, in handle
    await self.app(scope, receive, send)
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/starlette/routing.py", line 66, in app
    response = await func(request)
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/fastapi/routing.py", line 273, in app
    raw_response = await run_endpoint_function(
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/fastapi/routing.py", line 190, in run_endpoint_function
    return await dependant.call(**values)
  File "/home/lscm/Desktop/workplace/FastMap/src/main.py", line 184, in create_large_file_api
    f = project.files.create({'file_path': destination_path,
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/gitlab/cli.py", line 71, in wrapped_f
    return f(*args, **kwargs)
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/gitlab/exceptions.py", line 336, in wrapped_f
    return f(*args, **kwargs)
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/gitlab/v4/objects/files.py", line 164, in create
    server_data = self.gitlab.http_post(path, post_data=new_data, **kwargs)
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/gitlab/client.py", line 1021, in http_post
    result = self.http_request(
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/gitlab/client.py", line 725, in http_request
    result = self._backend.http_request(
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/gitlab/_backends/requests_backend.py", line 123, in http_request
    response: requests.Response = self._client.request(
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/home/lscm/.conda/envs/restful/lib/python3.9/site-packages/requests/adapters.py", line 502, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

Specifications

  • python-gitlab version: 3.15.0
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): 16.4.0 (local docker)
@JohnVillalovos
Copy link
Member

Can you reproduce this on https://gitlab.com/ ? If not then probably some configuration issue on the locally installed version of GitLab and not a python-gitlab issue.

@nejch
Copy link
Member

nejch commented Nov 3, 2023

I agree with @JohnVillalovos here. @Breezewrf can you try to reproduce this on GitLab.com so we can rule out server-side issues?

@nejch
Copy link
Member

nejch commented Nov 28, 2023

As we haven't heard back I'll close this one, but feel free to reopen if you can send us a reproduction example that we can take a look at 🙇 Especially as it seems this was just on a local docker container and not a production setup.

@nejch nejch closed this as completed Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants