# WeaviateQueryError: Query call with protocol GRPC search failed with message Socket closed

**URL:** <https://forum.weaviate.io/t/weaviatequeryerror-query-call-with-protocol-grpc-search-failed-with-message-socket-closed/1311>\
**Category:** Support\
**Created:** [January 28, 2024, 12:58am UTC](https://forum.weaviate.io/t/weaviatequeryerror-query-call-with-protocol-grpc-search-failed-with-message-socket-closed/1311 "2024-01-28T00:58:50Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![vamsi](https://avatars.discourse-cdn.com/v4/letter/v/b38774/32.png) [@vamsi](https://forum.weaviate.io/u/vamsi)\
**Post date:** [January 28, 2024, 12:58am UTC](https://forum.weaviate.io/t/weaviatequeryerror-query-call-with-protocol-grpc-search-failed-with-message-socket-closed/1311/1 "2024-01-28T00:58:50Z")

</div>

## Server

I have weaviate hosted on k8s with grpc enabled as follows:

```auto
# The service controls how weaviate gRPC endpoint is exposed to the outside world.
# If you don't want a public load balancer, you can also choose 'ClusterIP' to make
# weaviate gRPC port be only accessible within your cluster.
grpcService:
  # Set this to true in order to deploy Weaviate gRPC service
  enabled: true
  name: weaviate-grpc
  ports:
    - name: grpc
      protocol: TCP
      port: 50052
      # Target port is going to be the same for every port
  type: LoadBalancer
  loadBalancerSourceRanges: []
  # optionally set cluster IP if you want to set a static IP
  clusterIP:
  annotations: {}

```

```auto
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/weaviate LoadBalancer a.b.c.d e.f.g.h 80:30357/TCP 8d
service/weaviate-grpc LoadBalancer i.j.k.l m.n.o.p 50052:31927/TCP 8d
service/weaviate-headless ClusterIP None <none> 80/TCP 8d

```

## Client

I’m on `weaviate-client-4.4b8` python client.

When I try to query weaviate with bm25 or hybrid search using the python v4 client I am getting following error:

```auto
_InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
	status = StatusCode.UNAVAILABLE
	details = "Socket closed"
	debug_error_string = "UNKNOWN:Error received from peer {grpc_message:"Socket closed", grpc_status:14, created_time:"2024-01-27T19:46:26.102631-05:00"}"
>

During handling of the above exception, another exception occurred:

WeaviateQueryError Traceback (most recent call last)
.
.
.
  561 return res
    563 except grpc.RpcError as e:
--> 564 raise WeaviateQueryError(e.details(), "GRPC search")

WeaviateQueryError: Query call with protocol GRPC search failed with message Socket closed.

```

I am instantiating weaviate as follows:

```auto
target_client = weaviate.connect_to_custom(
    http_host="e.f.g.h",
    http_port="80",
    http_secure=False,
    grpc_host="m.n.o.p",
    grpc_port="50052",
    grpc_secure=False,
    auth_credentials=AuthApiKey("xxxxxxxxxx")
)

```

Any help is appreciated. Thank you.

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [February 2, 2024, 12:43pm UTC](https://forum.weaviate.io/t/weaviatequeryerror-query-call-with-protocol-grpc-search-failed-with-message-socket-closed/1311/2 "2024-02-02T12:43:44Z")

</div>

Hi @vamsi.

Were you able to fix this?

Weaviate Python v4 Client is now available. Also, make sure to run it with the latest Weaviate server, so you need to change the tag in your values.yml too

You shouldn’t have any issues deploying on K8s with our helm chart, unless your loadbalancer is interfering.

Let me know if I can help.

Thanks!

---

<div class="post-metadata">

**Author:** ![vamsi](https://avatars.discourse-cdn.com/v4/letter/v/b38774/32.png) [@vamsi](https://forum.weaviate.io/u/vamsi)\
**Post date:** [February 3, 2024, 2:38am UTC](https://forum.weaviate.io/t/weaviatequeryerror-query-call-with-protocol-grpc-search-failed-with-message-socket-closed/1311/3 "2024-02-03T02:38:46Z")

</div>

This issue has been resolved with the latest versions of python client and weaviate @DudaNogueira . Thanks for the help

---

<div class="post-metadata">

**Author:** ![zbloss](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/zbloss/32/1749_2.png) [@zbloss](https://forum.weaviate.io/u/zbloss)\
**Post date:** [June 15, 2024, 3:48pm UTC](https://forum.weaviate.io/t/weaviatequeryerror-query-call-with-protocol-grpc-search-failed-with-message-socket-closed/1311/5 "2024-06-15T15:48:00Z")

</div>

Can you tell me which versions of weaviate and the python client you were using?

I am facing this same issue using weaviate==1.24.5 and weaviate-client==4.6.4

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [June 17, 2024, 5:58pm UTC](https://forum.weaviate.io/t/weaviatequeryerror-query-call-with-protocol-grpc-search-failed-with-message-socket-closed/1311/6 "2024-06-17T17:58:30Z")

</div>

hi @zbloss !!

You need to expose both ports for HTTP and GRPC.

How is your cluster deployed?

---

<div class="post-metadata">

**Author:** ![zbloss](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/zbloss/32/1749_2.png) [@zbloss](https://forum.weaviate.io/u/zbloss)\
**Post date:** [June 17, 2024, 6:25pm UTC](https://forum.weaviate.io/t/weaviatequeryerror-query-call-with-protocol-grpc-search-failed-with-message-socket-closed/1311/7 "2024-06-17T18:25:18Z")

</div>

I am running weaviate as a statefulset

```yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: weaviate-statefulset
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: weaviate
    spec:
      containers:
        - name: weaviate-container
          image: semitechnologies/weaviate:1.25.4
          command: ["/bin/weaviate"]
          args:
            - '--host'
            - '0.0.0.0'
            - '--port'
            - '8080'
            - '--scheme'
            - 'http'
            - --read-timeout=600s 
            - --write-timeout=600s
          ports:
            - containerPort: 8080
            - containerPort: 50051

```

And have a service object exposing both ports as below:

```yaml
apiVersion: v1
kind: Service
metadata:
  name: weaviate-service
spec:
  selector:
    matchLabels:
      app: weaviate
  ports:
    - port: 8080
      targetPort: 8080
      name: http
    - port: 2112
      targetPort: 2112
      name: metrics
    - port: 50051
      targetPort: 50051
      name: grpc
  type: ClusterIP
  selector:
    app: weaviate

```

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [June 17, 2024, 7:04pm UTC](https://forum.weaviate.io/t/weaviatequeryerror-query-call-with-protocol-grpc-search-failed-with-message-socket-closed/1311/8 "2024-06-17T19:04:28Z")

</div>

This is how you can check if your GRPC service is up and running:

For non TLS/SSL:

```auto
# lets test our grpc connection
❯ wget https://raw.githubusercontent.com/grpc/grpc/master/src/proto/grpc/health/v1/health.proto
❯ grpcurl --plaintext -d '{"service": "Weaviate"}' -proto health.proto grpc.weaviate.mydomain.com:50051 grpc.health.v1.Health/Check
{
  "status": "SERVING"
}

```

Let me know if you can do this test and have this same outcome?

Thanks!

---

<div class="post-metadata">

**Author:** ![zbloss](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/zbloss/32/1749_2.png) [@zbloss](https://forum.weaviate.io/u/zbloss)\
**Post date:** [June 17, 2024, 7:35pm UTC](https://forum.weaviate.io/t/weaviatequeryerror-query-call-with-protocol-grpc-search-failed-with-message-socket-closed/1311/9 "2024-06-17T19:35:33Z")

</div>

Yes I’m also getting

```auto
{
    "status": "SERVING"
}

```

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [June 17, 2024, 7:42pm UTC](https://forum.weaviate.io/t/weaviatequeryerror-query-call-with-protocol-grpc-search-failed-with-message-socket-closed/1311/10 "2024-06-17T19:42:35Z")

</div>

Ok, can you share the code you have that is getting this error?

Thanks!

---

<div class="post-metadata">

**Author:** ![zbloss](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/zbloss/32/1749_2.png) [@zbloss](https://forum.weaviate.io/u/zbloss)\
**Post date:** [June 17, 2024, 7:55pm UTC](https://forum.weaviate.io/t/weaviatequeryerror-query-call-with-protocol-grpc-search-failed-with-message-socket-closed/1311/11 "2024-06-17T19:55:22Z")

</div>

Instantiating a client will produce the error unless I set `skip_init_checks=True`.

When I enable `skip_init_checks` I don’t get the error until I run a query.

```python

import weaviate
import weaviate.classes as wvc
from weaviate.collections.classes.internal import Object, QueryReturn

class MyWeaviateClient:

    weaviate_host: str
    weaviate_http_port: int
    weaviate_grpc_port: int
    weaviate_query_timeout_seconds: int
    weaviate_insert_timeout_seconds: int
    weaviate_init_timeout_seconds: int
    weaviate_skip_init_checks: bool

    @property
    def client(self) -> weaviate.WeaviateClient:
        weaviate_client: weaviate.WeaviateClient = weaviate.connect_to_custom(
            http_host=self.weaviate_host,
            http_port=self.weaviate_http_port,
            http_secure=False,
            grpc_host=self.weaviate_host,
            grpc_port=self.weaviate_grpc_port,
            grpc_secure=False,
            additional_config=wvc.init.AdditionalConfig(
                timeout=wvc.init.Timeout(
                    query=self.weaviate_query_timeout_seconds,
                    insert=self.weaviate_insert_timeout_seconds,
                    init=self.weaviate_init_timeout_seconds,
                )
            ),
            skip_init_checks=self.weaviate_skip_init_checks,
        )

        return weaviate_client
    
    @property
    def example_collection(self) -> weaviate.collections.Collection:
        return self.client.collections.get("Example")
    
    def query_example_collection(self, limit: int = 100) -> list[Object]:
        
        query_return: QueryReturn = self.example_collection.query.fetch_objects(
            limit=limit
        )

        return query_return.objects

if __name__ == " __main__":

    client: MyWeaviateClient = MyWeaviateClient(
        weaviate_host="localhost",
        weaviate_http_port=8080,
        weaviate_grpc_port=50051,
        weaviate_query_timeout_seconds=60,
        weaviate_insert_timeout_seconds=60,
        weaviate_init_timeout_seconds=30,
        weaviate_skip_init_checks=True,
    )

    objects: list[Object] = client.query_example_collection(limit=10)

```

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [June 17, 2024, 8:32pm UTC](https://forum.weaviate.io/t/weaviatequeryerror-query-call-with-protocol-grpc-search-failed-with-message-socket-closed/1311/12 "2024-06-17T20:32:09Z")

</div>

can you specify those in your `custom_to_custom`

```auto
http_secure=False,
grpc_secure=False

```

Thanks!

---

<div class="post-metadata">

**Author:** ![zbloss](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/zbloss/32/1749_2.png) [@zbloss](https://forum.weaviate.io/u/zbloss)\
**Post date:** [June 17, 2024, 8:35pm UTC](https://forum.weaviate.io/t/weaviatequeryerror-query-call-with-protocol-grpc-search-failed-with-message-socket-closed/1311/13 "2024-06-17T20:35:27Z")

</div>

Yes, I get the same error

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [June 17, 2024, 8:47pm UTC](https://forum.weaviate.io/t/weaviatequeryerror-query-call-with-protocol-grpc-search-failed-with-message-socket-closed/1311/14 "2024-06-17T20:47:12Z")

</div>

Are you running this locally? Using something like Kind?

Also, are you using our helm chart?

> **[GitHub - weaviate/weaviate-helm: Helm charts to deploy Weaviate to k8s](https://github.com/weaviate/weaviate-helm)**
>
> Helm charts to deploy Weaviate to k8s. Contribute to weaviate/weaviate-helm development by creating an account on GitHub.

I could try reproducing this deployment.

Thanks!

---

<div class="post-metadata">

**Author:** ![zbloss](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/zbloss/32/1749_2.png) [@zbloss](https://forum.weaviate.io/u/zbloss)\
**Post date:** [June 17, 2024, 9:40pm UTC](https://forum.weaviate.io/t/weaviatequeryerror-query-call-with-protocol-grpc-search-failed-with-message-socket-closed/1311/15 "2024-06-17T21:40:41Z")

</div>

I am not using the helm chart. I have this deployed in google kubernetes engine. The error does not always appear which is equally confusing

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [June 21, 2024, 11:17am UTC](https://forum.weaviate.io/t/weaviatequeryerror-query-call-with-protocol-grpc-search-failed-with-message-socket-closed/1311/16 "2024-06-21T11:17:52Z")

</div>

Strange. Nothing on logs from Weaviate or firewall?

---

<div class="post-metadata">

**Author:** ![ajay](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/ajay/32/2468_2.png) [@ajay](https://forum.weaviate.io/u/ajay)\
**Post date:** [October 11, 2024, 5:15am UTC](https://forum.weaviate.io/t/weaviatequeryerror-query-call-with-protocol-grpc-search-failed-with-message-socket-closed/1311/17 "2024-10-11T05:15:50Z")

</div>

Hey @zbloss , did you get your issue solved? what was the RCA? I am also facing similar issue with query when I set skip\_init\_checks=True.

---

<div class="post-metadata">

**Author:** ![DudaNogueira](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/dudanogueira/32/7846_2.png) [@DudaNogueira](https://forum.weaviate.io/u/DudaNogueira)\
**Post date:** [October 14, 2024, 11:05pm UTC](https://forum.weaviate.io/t/weaviatequeryerror-query-call-with-protocol-grpc-search-failed-with-message-socket-closed/1311/18 "2024-10-14T23:05:39Z")

</div>

hi @ajay !

Not sure those are related 🤔
