How to troubleshoot `ipfs cat /ipfs/<cid>` hanging?

I have a server node and a local node. I added & pinned a file from local, identified by <cid> . but when I run ipfs cat /ipfs/<cid> from the server node, it hangs.

But what’s really weird is if I run ipfs dht findprovs <cid>, the server node appropriately finds my local node’s peer id. And then the local peer id is listed under ipfs swarm peers. And even after this, ipfs cat still hangs. Why would fetching the content hang if my server node (evidently) knows where to find it?

you said , server node, local node ,so I think , the server node have public IP ,and local node behind NAT . right?

if you set the bootstrap node of local node as server node , it will be works fine.
if not , your server node will connect to your local node behind NAT fail unless your local node has actively connected to the server node once, OR some relay node help your server node connect to your local node

It’s because it doesn’t know where to find it. For whatever reason it might not see the CID in the DHT, or might not know the peer has the record.

It’s possible you need to reprovide the record, unsure. ipfs bitswap reprovide

I find if you disconnect the peer and reconnect it can be quite fast too. I also have a similar setup, a heavy desktop node, a server, and a laptop. I want them all connected to eachother so they can find similar data. It works pretty well, but sometimes has hiccups.