DB-Sync fails connecting to the node

Hey there,

Even though I have set up db-sync a couple times before, I can’t get it to work anymore on a new machine… I followed the guide on https://docs.cardano.org/projects/cardano-db-sync/en/latest/getting-started/building-running.html

When launching db-sync, it correctly populates the database with the genesis distribution, but then throws an error when trying to connect to the node. This is the output, hopefully someone can point me in the right direction, as i have no idea about the cause (node is synced up and running on the same machine):

user@server:~/cardano-db-sync$ PGPASSFILE=config/pgpass db-sync-node/bin/cardano-db-sync \

--config config/mainnet-config.yaml \
--socket-path ../cardano-node/state-node-mainnet/node.socket \
--schema-dir schema/

[db-sync-node:Info:4] [2020-09-24 16:41:29.36 UTC] NetworkMagic: 764824073
[db-sync-node:Info:4] [2020-09-24 16:41:29.37 UTC] Inserting Byron Genesis distribution
[db-sync-node:Info:4] [2020-09-24 16:42:00.92 UTC] Initial genesis distribution populated. Hash 5f20df933584822601f9e3f8c024eb5eb252fe8cefb24d1317dc3d432e940ebb
[db-sync-node:Info:4] [2020-09-24 16:42:00.93 UTC] Total genesis supply of Ada: 31112484745.000000
[db-sync-node:Info:4] [2020-09-24 16:42:00.95 UTC] Inserting Shelley Genesis distribution
[db-sync-node:Info:4] [2020-09-24 16:42:00.96 UTC] localInitiatorNetworkApplication: connecting to node via “…/cardano-node/state-node-mainnet/node.socket”
[db-sync-node.Handshake:Info:30] [2020-09-24 16:42:00.96 UTC] [String “Send MsgProposeVersions (fromList [(NodeToClientV_1,TInt 764824073),(NodeToClientV_2,TInt 764824073),(NodeToClientV_3,TInt 764824073)])”,String “LocalHandshakeTrace”,String “ConnectionId {localAddress = LocalAddress {getFilePath = ""}, remoteAddress = LocalAddress {getFilePath = "state-node-mainnet/node.socket"}}”]
[db-sync-node.Handshake:Info:30] [2020-09-24 16:42:00.96 UTC] [String “Recv MsgAcceptVersion NodeToClientV_3 (TInt 764824073)”,String “LocalHandshakeTrace”,String “ConnectionId {localAddress = LocalAddress {getFilePath = ""}, remoteAddress = LocalAddress {getFilePath = "state-node-mainnet/node.socket"}}”]
[db-sync-node:Info:34] [2020-09-24 16:42:00.96 UTC] Starting chainSyncClient
[db-sync-node:Error:34] [2020-09-24 16:42:00.96 UTC] ChainSyncWithBlocksPtcl: ledger-state: getDirectoryContents:openDirStream: does not exist (No such file or directory)
[db-sync-node.Subscription:Error:30] [2020-09-24 16:42:00.97 UTC] [String “Application Exception: LocalAddress {getFilePath = "…/cardano-node/state-node-mainnet/node.socket"} ledger-state: getDirectoryContents:openDirStream: does not exist (No such file or directory)”,String “SubscriptionTrace”]
[db-sync-node.ErrorPolicy:Error:4] [2020-09-24 16:42:00.97 UTC] [String “ErrorPolicyUnhandledApplicationException ledger-state: getDirectoryContents:openDirStream: does not exist (No such file or directory)”,String “ErrorPolicyTrace”,String “LocalAddress {getFilePath = "…/cardano-node/state-node-mainnet/node.socket"}”]

As the output suggests, it is not able to find the location of the node.socket file (either the relative path is incorrect or the file does not exist).

If the path is correct, but the folder is empty (and your node is running on same box), a common cause of socket file not existing is when someone attempts to do a start while node is already running. While you may see an error and failure for second instance, your socket file would predominantly get deleted, causing he mentioned scenario.

1 Like

Thanks for the help, but I have checked the paths multiple times and don’t see any issues. I have the same folder structure as in the tutorial, and the socket is correctly created in ~/cardano-node/state-node-mainnet/node.socket after starting the node.

Also the moment DB-Sync throws the Error, the Node also throws one:

[server:cardano.node.ChainDB:Notice:36] [2020-09-25 09:08:29.13 UTC] Chain extended, new tip: 2286fbdec8ea2911e4e3c32d51b2b0c79361f940ea88759444448b111dec2795 at slot 9458618
[server:cardano.node.LocalErrorPolicy:Error:55] [2020-09-25 09:08:35.90 UTC] [String “ErrorPolicyUnhandledApplicationException (MuxError MuxBearerClosed “<socket: 27> closed when reading data, waiting on next header True”)”,String “ErrorPolicyTrace”,String “LocalAddress {getFilePath = “”}”]
[server:cardano.node.ChainDB:Notice:36] [2020-09-25 09:08:37.07 UTC] Chain extended, new tip: b6916bcc70cb5afa64a6277c6405b13ba85f26c07e426cca8f5b457cd7f90c8c at slot 9458626

So the socket path should be correct, with even some form of communication between the two no? Also launching db-sync with an incorrect socket-path throws a different error than the one i get. Tried this on multiple operating systems but always the same problem :frowning:

@Antonio3 i’m running into this same error message and i was advised to use db-sync 5.0.1 instead of the master version.

I’ll post back if it works!

UPDATE
5.0.1 works! :slight_smile:

2 Likes

Thx!! :pray:

can confirm 5.0.1 works