Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug API returns execution timeout error sometimes #358

Closed
gzliudan opened this issue Nov 14, 2023 · 2 comments
Closed

debug API returns execution timeout error sometimes #358

gzliudan opened this issue Nov 14, 2023 · 2 comments

Comments

@gzliudan
Copy link
Collaborator

gzliudan commented Nov 14, 2023

The debug API returns "execution timeout" error in result sometimes as reported by the post. These affected APIs include:

  • debug_traceBlockByNumber
  • debug_traceBlockByHash
  • debug_traceBlock
  • debug_traceChain
  • debug_traceTransaction

Here are some test cases:

debug_traceBlockByNumber

request

RPC="https://earpc.xinfin.network/"
NUMBER="0x407ea73"

curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
  "jsonrpc": "2.0",
  "id": 1001,
  "method": "debug_traceBlockByNumber",
  "params": [
    "'"${NUMBER}"'", {
        "tracer":"callTracer"
    }
  ]
}' | jq

response

{
  "jsonrpc": "2.0",
  "id": 1001,
  "result": [
    {
      "result": {
        "type": "CALL",
        "from": "0x619f838ea2a12cdb508e759c3e0697e021d52ceb",
        "to": "0x0000000000000000000000000000000000000092",
        "value": "0x0",
        "gas": "0x261f6f8",
        "gasUsed": "0x0",
        "input": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b42156e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
        "output": "0x",
        "time": "11.671µs"
      }
    },
    {
      "result": {
        "type": "CALL",
        "from": "0x0253dce2142249247c394986eb5229df3d785916",
        "to": "0x6bec40a0129224309460e3f912a8b14e2f2770c1",
        "value": "0x0",
        "gas": "0x142f58",
        "gasUsed": "0x40d85",
        "input": "0xb3c07a870000000000000000000000000000000000000000000000037786a2905164b04f0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000300000000000000000000000071725550d53ecc0a58d07d2312b1ec0ee05ebdab000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000c8f9a65287fc4c37f8961d82687858e34445a507000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000a5a5f8fec8367045c70aa830a1b21c1e26999f90000000000000000000000000000000000000000000000000000000000000001e",
        "error": "execution reverted",
        "time": "280.699804ms",
        "calls": []
      }
    },
    {
      "result": {
        "type": "CALL",
        "from": "0x30e44f7d993d27248bff62afbaba701749333333",
        "to": "0x6fe764b38ebb585654836321e863b4fd22764307",
        "value": "0x0",
        "gas": "0x1c9148",
        "gasUsed": "0x47985",
        "input": "0x52317ad0000000000000000000000000951857744785e80e2de051c32ee7b25f9c458c420000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000071725550d53ecc0a58d07d2312b1ec0ee05ebdab00000000000000000000000047f6399aa1bafe0c5b8bdcf3efffcc25c71822a3000000000000000000000000bd992e13e39b394dbf74090b68d74f177d2e2951",
        "output": "0x",
        "time": "367.656879ms",
        "calls": []
      }
    },
    {
      "error": "execution timeout"
    }
  ]
}

debug_traceTransaction

request

RPC="https://earpc.xinfin.network/"
HASH="0xdb68990d4581ad17843f0329636b3f1d4416eafefc79583f42182419b573d0cb"

curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
  "jsonrpc": "2.0",
  "id": 1002,
  "method": "debug_traceTransaction",
  "params": [
    "'"${HASH}"'", {
        "tracer":"callTracer"
    }
  ]
}' | jq

response

{
  "jsonrpc": "2.0",
  "id": 1002,
  "error": {
    "code": -32000,
    "message": "execution timeout"
  }
}
@gzliudan gzliudan changed the title debug api return execution timeout error sometimes debug API returns execution timeout error sometimes Nov 14, 2023
@gzliudan
Copy link
Collaborator Author

gzliudan commented Nov 20, 2023

The default write timeout of RPC http server is 10 secondes:

func NewHTTPServer(cors []string, vhosts []string, srv *Server) *http.Server {
	// Wrap the CORS-handler within a host-handler
	handler := newCorsHandler(srv, cors)
	handler = newVHostHandler(vhosts, handler)
	return &http.Server{
		Handler:      handler,
		ReadTimeout:  5 * time.Second,
		WriteTimeout: 10 * time.Second,
		IdleTimeout:  120 * time.Second,
	}
}

But the debug API costs very long time sometime. With PR #363 patched on my local node, I found:

1700480333493

The above response time is 86 secondes.

gzliudan added a commit to gzliudan/XDPoSChain that referenced this issue Nov 27, 2023
@gzliudan
Copy link
Collaborator Author

Closed by #363

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant