<p>I haven't had this issue before and I've been spamming my RPC pretty hard.</p>

<p>Does your bitcoind already contain the whole blockchain or is it still updating?</p>

<p>There's a <code>debug.log</code> and <code>db.log</code> in the bitcoind data directory, I guess those will tell you what's wrong.</p>

CC BY-SA 3.0
2014-06-24T07:44:07.637Z
2014-06-24T07:44:07.637Z
Ruben de Vries
<p>I'm building a node.js app that uses a json-rpc connection to fetch information from the bitcoin daemon.</p>

<p>It works great, except every once in a while, the RPC connection "fails." It goes down for anywhere from 1-20 seconds. Querying it via the command line gives the response: <code>error: couldn't connect to server</code>. I have built in an error handling mechanism that waits a progressively larger amount of time for each unsuccessful connection, and it works well.</p>

<p>My problem, is over the course of progressively scanning the blockchain, over half of the running time is spent waiting for the daemon to come alive.</p>

<p>My thought was maybe its my hard drive/something with my computer, so I moved it to an ec2 instance (specifically c3.2xl) and moved the blockchain to the SSD. This actually <em>increased</em> the amount of time waiting versus running the node app locally.</p>

<p>Has anyone experienced this before and came up with a solution?</p>

CC BY-SA 3.0
2014-06-24T01:03:00.613Z
That is a great analysis, unfortunately, I'm dealing with live data so stopping the daemon to safely use the blockchain files is not an option.
Nathan
CC BY-SA 3.0
2014-06-24T13:05:08.430Z
Have you changed some config in `.bitcoin/bitcoin.conf`? Have you tried tweaking the `-par` option?
knaperek
CC BY-SA 3.0
2014-10-22T18:35:43.150Z
You're probably running out of local TCP ports. You need to reuse your RPC connections rather than sending each RPC request over its own connection.
David Schwartz
<json-rpc>
RPC connection fails after too many queries
Nathan
# RPC connection fails after too many queries

(Asked by: username_0 on 2014-06-23)

I'm building a node.js app that uses a json-rpc connection to fetch information from the bitcoin daemon.

It works great, except every once in a while, the RPC connection "fails." It goes down for anywhere from 1-20 seconds. Querying it via the command line gives the response: `error: couldn't connect to server`. I have built in an error handling mechanism that waits a progressively larger amount of time for each unsuccessful connection, and it works well.

My problem, is over the course of progressively scanning the blockchain, over half of the running time is spent waiting for the daemon to come alive.

My thought was maybe its my hard drive/something with my computer, so I moved it to an ec2 instance (specifically c3.2xl) and moved the blockchain to the SSD. This actually *increased* the amount of time waiting versus running the node app locally.

Has anyone experienced this before and came up with a solution?

**Tags:** json-rpc

> **Comments:**
> **username_0**: That is a great analysis, unfortunately, I'm dealing with live data so stopping the daemon to safely use the blockchain files is not an option.  
> **username_1**: Have you changed some config in `.bitcoin/bitcoin.conf`? Have you tried tweaking the `-par` option?  
> **username_2**: You're probably running out of local TCP ports. You need to reuse your RPC connections rather than sending each RPC request over its own connection.  

---

## 1 answers

### Answer by username_3 on 2014-06-24. Score: 1

I haven't had this issue before and I've been spamming my RPC pretty hard.

Does your bitcoind already contain the whole blockchain or is it still updating?

There's a `debug.log` and `db.log` in the bitcoind data directory, I guess those will tell you what's wrong.


---

