Weaviate server closes connection unexpectedly

Hi there!
On importing data to weaviate, I check if the class exists.
But quite often it fails to check if a class exists.

requests.exceptions.ConnectionError: Checking class existence could not be done.

I think it’s because the server closes the connection unexpectedly.
This is how I check for the class existence.

# PYTHON CODE TO SAVE OBJECT 
source_class = settings.KNOWLEDGE_SOURCE_CLASS.format(user_id)
content_class = settings.CONTENT_CLASS.format(user_id)
    try:
        if not client.schema.exists(source_class):
            print("[!] Schema doesn't exist. Initializing...")
            logger.debug(f"Initializing {user_id} schema")
            knowledge_source = {...}
            content = {...}
            client.schema.create({"classes": [knowledge_source, content]})

I end up getting the following error:

  File "/home/glitch/nous-backend/src/indexer.py", line 34, in indexer
    if not client.schema.exists(source_class):
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/glitch/nous-backend/.venv/lib/python3.11/site-packages/weaviate/schema/crud_schema.py", line 318, in exists
    raise RequestsConnectionError(
requests.exceptions.ConnectionError: Checking class existence could not be done.

Going through the stack trace i think these are the chunks:

.....
  File "/usr/lib/python3.11/http/client.py", line 287, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

.....
  File "/usr/lib/python3.11/http/client.py", line 287, 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:
.......
  File "/home/glitch/nous-backend/.venv/lib/python3.11/site-packages/requests/adapters.py", line 501, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

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

  File "/home/glitch/nous-backend/.venv/lib/python3.11/site-packages/weaviate/schema/crud_schema.py", line 318, in exists
    raise RequestsConnectionError(
requests.exceptions.ConnectionError: Checking class existence could not be done.

Hi! Where is your weaviate? Locally or at our WCS?

Should have mentioned that!
I’m using a trial cluster at WCS.

This may be an unstable connection from the client to the server.

Can you try the same code but with a local weaviate? So local client connecting to a local weaviate server?

This code is running on a Google Cloud instance deployed. I don’t think it would have internet connection issues?
It is deployed on an Asian region though. Could that be a reason?

It can be a network/route issue, a WCS (Saas) issue itself, or a Weaviate (Product) issue.

So if we are able to remove the networking part of the equation, run it all local, and still be able to reproduce it, we can have a path to follow.

Also, running it locally, would allow you to have a look at logs, so we can check for any outstanding messages.

Thanks!

i have this issue locally
opening on browser works fine

ConnectionClosed: The socket connection was closed unexpectedly. For more information, pass verbose: true in the second argument to fetch()
path: “http://localhost:8086/v1/objects

i think i might have found the issue, some kind of data corruption. making a new data store seems to work:

    - ./data2:/var/lib/weaviate

was on ./data:/var/lib/weaviate

1 Like

hi @James_Tan !! Welcome to our community :hugs:

Thanks for sharing.

Were you able to get any error logs related to this from the server side?

Thanks!