Skip to content

Frequent httpx.RemoteProtocolError: Server disconnected #1064

Open
@immortal3

Description

@immortal3

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

When making API requests to Supabase using PostgREST client, the server unexpectedly disconnects, resulting in a httpx.RemoteProtocolError: Server disconnected error. This happens intermittently when trying to retrieve data from a specific table or batch insert.

To Reproduce

Steps to reproduce the behavior:

  1. Set up a connection to Supabase using client
  2. Attempt to execute a query to retrieve data from a table
  3. The server disconnects during the request, throwing a RemoteProtocolError

Code snippet demonstrating the issue:

# Using postgrest client to query a table
result = client.table("my_table").select("*").eq("key", "value").execute()
# This results in server disconnection

Expected behavior

The query should complete successfully and return the requested data without any server disconnection.

System information

  • OS: Linux
  • Version of postgrest-py: [latest]
  • Version of httpx: [latest]
  • Python version: 3.11

Additional context

As of now, We have added retry mechanism over certain call during exception of HTTPX disconnect. Following stack trace,

  File "/usr/local/lib/python3.11/site-packages/postgrest/_sync/request_builder.py", line 58, in execute
    r = self.session.request(
        ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 825, in request
    return self.send(request, auth=auth, follow_redirects=follow_redirects)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/dd_tracer/python/ddtrace/contrib/internal/httpx/patch.py", line 166, in _wrapped_sync_send
    resp = wrapped(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 914, in send
    response = self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 942, in _send_handling_auth
    response = self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 979, in _send_handling_redirects
    response = self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpx/_client.py", line 1014, in _send_single_request
    response = transport.handle_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 249, in handle_request
    with map_httpcore_exceptions():
  File "/usr/local/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "/usr/local/lib/python3.11/site-packages/httpx/_transports/default.py", line 118, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.RemoteProtocolError: Server disconnected

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions