cardano-graphql icon indicating copy to clipboard operation
cardano-graphql copied to clipboard

Manual restart docker graphql required after syncing db

Open RdeWilde opened this issue 3 years ago • 2 comments

Summary

When booting my node, it'll start syncing (after installing the snapshot) which will take some time. This results in sockets not being available yet etc. Therefore cardano-graphql will exit.

To get the graphql up and running I have to manually restart it after sync has completed.

How can I make it restart automatically or something like that? I hoped it already did, but after waiting an hour I gave up 😅

Steps to reproduce the bug

  • Launch new docker(-compose) stack for GraphQL.
  • Give it time to sync.
  • Do a test cURL request, and it'll give you an error:
  • curl -X POST -H "Content-Type: application/json" -d '{"query": "{ cardanoDbMeta { initialized syncPercentage }}"}' http://localhost:3100/graphql, it'll give you the 'actual result'
  • docker restasrt cardano-graphql
  • Try the cURL request again after waiting a few minutes
  • It'll give you the expected result.

Actual Result

curl: (56) Recv failure: Connection reset by peer

Expected Result

{"data":{"cardanoDbMeta":{"initialized":true,"syncPercentage":100}}}

Environment

cardano-node:1.35.2-1
cardano-graphql:master-testnet
cardano-graphql-hasura:6.2.0
cardano-db-sync:13.0.3
ogmios:v5.5.3-testnet

Platform

  • [X] Linux (Ubuntu)
  • [ ] Linux (Other)
  • [ ] macOS
  • [ ] Windows

Platform version

20.04

Runtime

  • [ ] Node.js
  • [X] Docker

Runtime version

20.10.17, build 100c701

RdeWilde avatar Aug 18 '22 08:08 RdeWilde

Thanks for the detailed report. I'll see what we can do to handle the initial startup more elegantly

rhyslbw avatar Sep 08 '22 16:09 rhyslbw

@rhyslbw same issue, after restart graphql, the running node index.js does not listen 3100 port at all!

root@a66dfb3debcf:/app/packages/server/dist# netstat -ntulp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.11:34583        0.0.0.0:*               LISTEN      -
udp        0      0 127.0.0.11:58658        0.0.0.0:*                           -
root@a66dfb3debcf:/app/packages/server/dist# ps -ef
UID          PID    PPID  C STIME TTY          TIME CMD
root           1       0  0 07:13 ?        00:00:01 node index.js
root         103       0  0 07:16 pts/0    00:00:00 /bin/bash
root         116     103  0 07:18 pts/0    00:00:00 ps -ef

lcgogo avatar Sep 25 '22 07:09 lcgogo