CardanoSolutions / ogmios

❇️ A WebSocket JSON/RPC bridge for Cardano
https://ogmios.dev
Mozilla Public License 2.0
304 stars 90 forks source link

cardano-node socket not found #5

Closed rhyslbw closed 4 years ago

rhyslbw commented 4 years ago

What Git revision are you using?

bc8872b594c5ec1d34fa919705962eb248d2b587

What operating system are you using, and which version?

Describe what the problem is?

NETWORK=mainnet docker-compose up
ogmios_1        | [ogmios:Info:7] [2020-09-30 10:48:31.43 UTC] OgmiosLookupEnv (LookupUserDefinedNetwork {using = ("mainnet",NetworkMagic {unNetworkMagic = 764824073})})
ogmios_1        | [ogmios:Warning:7] [2020-09-30 10:48:31.43 UTC] OgmiosSocketNotFound {path = "/ipc/node.socket"}
ogmios_1        | [ogmios:Info:7] [2020-09-30 10:48:31.43 UTC] OgmiosStarted {host = "0.0.0.0", port = 1337}
$ curl http://localhost:1337/health 
File not found                                    

Since cardano-node doesn't immediately create the socket, and Ogmios doesn't log further status after reporting the warning, it's not clear from the outside if it's performing a retry.

What should be the expected behavior?

Ogmios finds the socket after the node creates it, and the health check returns the success response.

KtorZ commented 4 years ago

Agreed. I have on the TODO list to make the log better. Now it's simply logging this as an "UnknownException" whereas this is a perfectly known and expected scenario.

I'll use that ticket for tracking the work :+1:

rhyslbw commented 4 years ago

Would be good to present the root URL since it's serving as a landing page. It's not actually working for me though; the health check is just reporting File not found

KtorZ commented 4 years ago

Interesting. The health check is actually an HTTP server serving some static files which are "mounted" at compile-time. So in principle, if the files are missing, it simply does not compile. I cannot reproduce on my side. Passing an invalid socket path gives me:

ogmios_1        | [ogmios:Info:4] [2020-09-30 14:15:03.74 UTC] OgmiosLookupEnv (LookupUserDefinedNetwork {using = ("testnet",NetworkMagic {unNetworkMagic = 1097911063})})
ogmios_1        | [ogmios:Error:13] [2020-09-30 14:15:03.74 UTC] OgmiosUnknownException {exception = Network.Socket.connect: <socket: 13>: does not exist (No such file or directory)}
ogmios_1        | [ogmios:Warning:4] [2020-09-30 14:15:03.74 UTC] OgmiosSocketNotFound {path = "/patate"}
ogmios_1        | [ogmios:Info:4] [2020-09-30 14:15:03.74 UTC] OgmiosStarted {host = "0.0.0.0", port = 1337}

And then:

$ curl http://localhost:1337/health | jq
{
  "runtimeStats": {
    "productivity": 0.62,
    "maxHeapSize": 209
  },
  "lastTipUpdate": null,
  "lastKnownTip": "origin",
  "totalConnections": 0,
  "sessionsDuration": {
    "max": 0,
    "mean": null,
    "min": 0
  },
  "activeConnections": 0
}

which is pretty much what I'd expect.

KtorZ commented 4 years ago

@rhyslbw could it be that you have another service listening on :1337 ?

KtorZ commented 4 years ago

40c7a9259b921dbfe9f5f0e901485b43d57db78f should improve the error message and the behavior of the health application when it can't connects to the node.

rhyslbw commented 4 years ago

@KtorZ Ah :facepalm: There's no issue here, I was just using the wrong build. Will add some more information to the README in #4