Execute query return : "context deadline exceeded"

The cluster configuration is as follows

The docker compose configuration is as follows

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

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

    }
}

Request URL:http://ip3:8080/query?timeout=20s&debug=true

Response

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

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

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

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

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.

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

{
  "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.

1 Like