Bitcoin Forum
April 24, 2024, 07:28:15 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Intermittent access issue with RPC client  (Read 748 times)
687_2 (OP)
Full Member
***
Offline Offline

Activity: 173
Merit: 105



View Profile
March 14, 2017, 08:36:24 AM
Merited by ABCbits (1)
 #1

I wrote up a script that uses this repo: https://github.com/laanwj/bitcoin-python

I know it's an older repo but I like it. Anyway, it works great most of the time. But sometimes my script just can't connect to my bitcoind -server for some inexplicable reason. Does anyone have a guess as to what that reason might be? I just upgraded to the latest version of core but the seemingly random issue persists.

Code:
class BitcoinConnection(object):
    """
    A BitcoinConnection object defines a connection to a bitcoin server.
    It is a thin wrapper around a JSON-RPC API connection.

    Arguments to constructor:

    - *user* -- Authenticate as user.
    - *password* -- Authentication password.
    - *host* -- Bitcoin JSON-RPC host.
    - *port* -- Bitcoin JSON-RPC port.
    """
    def __init__(self, user, password, host='localhost', port=8332,
                 use_https=False):
        """
        Create a new bitcoin server connection.
        """
        url = 'http{s}://{user}:{password}@{host}:{port}/'.format(
            s='s' if use_https else '',
            user=user, password=password, host=host, port=port)
        self.url = url
        self.proxy = AuthServiceProxy(url, exception_wrapper=wrap_exception)

And I am using this method:

Code:
    def getrawchangeaddress(self, account=None):
        """
        Returns a new bitcoin raw change address for properly handling change.

        """
        return self.proxy.getrawchangeaddress()

Bitcoind shows this in the log:
Code:
2017-03-14 08:33:36 connect() to 71.239.98.166:8333 failed after select(): Connection refused (61)

 Huh

Buy the dip with the security and privacy of your own wallet: use cross chain atomic swaps to trade Bitcoin, USDT, and Ether. Trades are secured and settled on-chain. https://sibex.io
"Your bitcoin is secured in a way that is physically impossible for others to access, no matter for what reason, no matter how good the excuse, no matter a majority of miners, no matter what." -- Greg Maxwell
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713943695
Hero Member
*
Offline Offline

Posts: 1713943695

View Profile Personal Message (Offline)

Ignore
1713943695
Reply with quote  #2

1713943695
Report to moderator
1713943695
Hero Member
*
Offline Offline

Posts: 1713943695

View Profile Personal Message (Offline)

Ignore
1713943695
Reply with quote  #2

1713943695
Report to moderator
687_2 (OP)
Full Member
***
Offline Offline

Activity: 173
Merit: 105



View Profile
March 14, 2017, 08:38:38 AM
 #2

Also, "success" looks like this I think:

Code:
2017-03-14 06:45:06 connect() to [2002:6dc4:bb6e::6dc4:bb6e]:8333 failed: No route to host (65)
2017-03-14 06:47:08 keypool added key 544, size=101
2017-03-14 06:47:08 keypool reserve 444
2017-03-14 06:47:08 keypool keep 444
2017-03-14 06:47:09 keypool added key 545, size=101
2017-03-14 06:47:09 keypool reserve 445
2017-03-14 06:47:10 keypool keep 445

Buy the dip with the security and privacy of your own wallet: use cross chain atomic swaps to trade Bitcoin, USDT, and Ether. Trades are secured and settled on-chain. https://sibex.io
psycodad
Legendary
*
Offline Offline

Activity: 1604
Merit: 1564


精神分析的爸


View Profile
March 14, 2017, 08:44:12 AM
Merited by ABCbits (1)
 #3

Did you try to increase the rpc threads, i.e. something like:

Code:
rpcthreads=30

in your .conf file ?

HTH

687_2 (OP)
Full Member
***
Offline Offline

Activity: 173
Merit: 105



View Profile
March 14, 2017, 09:17:12 AM
 #4

Did you try to increase the rpc threads, i.e. something like:

Code:
rpcthreads=30

in your .conf file ?

HTH

I'm going to try it, thanks! Restarted the server, so now I have to wait for it to verify the last 288 blocks...

Buy the dip with the security and privacy of your own wallet: use cross chain atomic swaps to trade Bitcoin, USDT, and Ether. Trades are secured and settled on-chain. https://sibex.io
cloverme
Legendary
*
Offline Offline

Activity: 1512
Merit: 1054


SpacePirate.io


View Profile WWW
March 14, 2017, 08:28:19 PM
Merited by ABCbits (1)
 #5

If you're running any network threat protection services from anti-malware or anti-virus packages, it might be blocking the traffic. It could also be something in the code that leaves the port session open without properly closing the session, so you can't start a new rpc session. Try using wireshark on one of your endpoints and see if the channel is being closed correctly. If you're not already doing so, whitelist your src/dest ip addresses in your firewall(s).
687_2 (OP)
Full Member
***
Offline Offline

Activity: 173
Merit: 105



View Profile
March 15, 2017, 06:42:35 AM
 #6

If you're running any network threat protection services from anti-malware or anti-virus packages, it might be blocking the traffic. It could also be something in the code that leaves the port session open without properly closing the session, so you can't start a new rpc session. Try using wireshark on one of your endpoints and see if the channel is being closed correctly. If you're not already doing so, whitelist your src/dest ip addresses in your firewall(s).

I just realized the issue: I completely forgot I was running TOR browser. I don't have time to play with TOR browser settings right now, so just closing it out resolves the issue.  Grin

Buy the dip with the security and privacy of your own wallet: use cross chain atomic swaps to trade Bitcoin, USDT, and Ether. Trades are secured and settled on-chain. https://sibex.io
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!