# Execute query return : "context deadline exceeded"

**URL:** https://discuss.dgraph.io/t/execute-query-return-context-deadline-exceeded/17082
**Category:** GraphQL
**Tags:** dgraph
**Created:** [March 23, 2022, 9:57am UTC](https://discuss.dgraph.io/t/execute-query-return-context-deadline-exceeded/17082 "2022-03-23T09:57:01Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![junghc](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@junghc](https://discuss.dgraph.io/u/junghc)
#### Post date: [March 23, 2022, 9:57am UTC](https://discuss.dgraph.io/t/execute-query-return-context-deadline-exceeded/17082/1 "2022-03-23T09:57:01Z")

</div>

The cluster configuration is as follows

 ![image](https://canada1.discourse-cdn.com/flex007/uploads/dgraph/original/2X/e/e368f9f0e453a3fa253e83e6d6459d69f28c520e.png)

The docker compose configuration is as follows

```auto
version: "3.2"
services:
  zero:
    image: dgraph/dgraph:v21.12-slash
    volumes:
      - /tmp/data:/dgraph
    ports:
      - 5080:5080
      - 6080:6080 
    restart: on-failure
    command: dgraph zero --my=ip3:5080 --replicas 3 --peer ip1:5080 --raft="idx=3"
    networks:
      - net-test
  alpha:
    image: dgraph/dgraph:v21.12-slash
    volumes:
      - /tmp/data/d0:/dgraph
    ports:
      - 7080:7080
      - 8080:8080
      - 9080:9080
    deploy:
      replicas: 1 
    restart: on-failure
    command: dgraph alpha --my=ip3:7080 --zero=ip1:5080,ip2:5080,ip3:5080 --security whitelist=0.0.0.0/0
    networks:
      - net-test
  alpha1:
    image: dgraph/dgraph:v21.12-slash
    volumes:
      - /tmp/data/d1:/dgraph
    ports:
      - 7081:7081
      - 8081:8081
      - 9081:9081 
    restart: on-failure
    command: dgraph alpha --my=ip3:7081 --zero=ip1:5080,ip2:5080,ip3:5080 --security whitelist=0.0.0.0/0 -o 1
    networks:
      - net-test
networks:
  net-test:
    ipam:
      config:
        - subnet: ip.0/24

```

Problem Description  
At the beginning of the cluster, everything was normal. After running for a period of time, the ip3:7080 alpha in Group1 cannot perform query query. The query statement is as follows

```auto
{
    query(func: type(user)) @filter(eq(name, "test")) {
        uid
        expand(_all_) {
            uid
            expand(_all_)
        }

    }
}

```

Request URL：[http://ip3:8080/query?timeout=20s&debug=true](http://ip3:8080/query?timeout=20s&debug=true)

Response

```auto
{
    "errors": [
        {
            "message": ": context deadline exceeded",
            "extensions": {
                "code": "ErrorInvalidRequest"
            }
        }
    ],
    "data": null
}

```

I don’t understand why this is happening, please help me with this

---

<div class="post-metadata">

### Author: ![pshaddel](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/pshaddel/32/11584_2.png) [@pshaddel](https://discuss.dgraph.io/u/pshaddel)
#### Post date: [March 23, 2022, 10:04am UTC](https://discuss.dgraph.io/t/execute-query-return-context-deadline-exceeded/17082/2 "2022-03-23T10:04:05Z")

</div>

Hi @junghc  
Your query timed out before getting the result 🙂 You can see the query timeout in the url that you pasted 20s. You can simply increase that using Ratel.

---

<div class="post-metadata">

### Author: ![junghc](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@junghc](https://discuss.dgraph.io/u/junghc)
#### Post date: [March 23, 2022, 10:15am UTC](https://discuss.dgraph.io/t/execute-query-return-context-deadline-exceeded/17082/3 "2022-03-23T10:15:21Z")

</div>

Thank you very much for your reply, Ratel is deployed on ip1, and the query from Ratel can return, but I am querying data in a Java program，JavaClient is configured with 6 alphas, and now ip3:8080 is unavailable, so the Java program is also unavailable. I now have two questions: First, why does this query timeout occur? Second, is it possible in JavaClient to detect if alpha is available? Not because an alpha is not available, the Java program is not available

---

<div class="post-metadata">

### Author: ![pshaddel](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/pshaddel/32/11584_2.png) [@pshaddel](https://discuss.dgraph.io/u/pshaddel)
#### Post date: [March 23, 2022, 11:06am UTC](https://discuss.dgraph.io/t/execute-query-return-context-deadline-exceeded/17082/4 "2022-03-23T11:06:15Z")

</div>

Before answering your questions I should mention that as far as I’m concerned the `v21.12-slash` image is for cloud usage. Also `v21.12` is unstable, I myself and some other people tried that and all of us had to rollback to `v21.03`.  
1- Ratel is just a client you can change configuration to make requests to anywhere you want.  
2- I do not know how the Java Client works but you can make a sample query after you created your client to check if it is working or not.

---

<div class="post-metadata">

### Author: ![junghc](https://avatars.discourse-cdn.com/v4/letter/j/f08c70/32.png) [@junghc](https://discuss.dgraph.io/u/junghc)
#### Post date: [March 24, 2022, 3:21am UTC](https://discuss.dgraph.io/t/execute-query-return-context-deadline-exceeded/17082/5 "2022-03-24T03:21:59Z")

</div>

Hi @pshaddel  
According to your suggestion, I connected ip3:8080 to query operation through Ratel, and the results obtained are as follows:

```auto
{
  "name": "t",
  "url": "http://10.11.35.248:8080/query?timeout=20s",
  "errors": [
    {
      "message": ": context deadline exceeded",
      "extensions": {
        "code": "ErrorInvalidRequest"
      }
    }
  ]
}

```

I will try to rollback the version to `v21.03`.

Regarding your second suggestion, ip3:8080 was working fine when I created the client, but after a while, it went wrong and I didn’t find how to remove the offending alpha from the client.
