I wrote a program that repeatedly requests for JSON responses from a Monero Wallet RPC at some time intervals ranging from 10 seconds to a minute. Everything is running on a testnet in my local network.
Strangely, the RPC often stops responding after a while, causing a time out error. I cannot even reconnect to the wallet once the error occurs.
I observed that the problem only occurs when I run multiple instances of the program at the same time. So perhaps there is some kind of collision happening. Each instance of the program is connected to a different wallet on a different port, though. Any help would be appreciated.
The following is the traceback output:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 387, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 383, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.6/http/client.py", line 1331, in getresponse
response.begin()
File "/usr/lib/python3.6/http/client.py", line 297, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.6/http/client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/lib/python3.6/socket.py", line 586, in readinto
return self._sock.recv_into(b)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 641, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.6/dist-packages/urllib3/util/retry.py", line 368, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.6/dist-packages/urllib3/packages/six.py", line 686, in reraise
raise value
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 603, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 389, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 307, in _raise_timeout
raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='127.0.0.1', port=28023): Read timed out. (read timeout=30)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/tmp/econ_reader.py", line 31, in <module>
tx = w.transfer(D[row['dest_addr']], Decimal(row['xmr_amount']))
File "/usr/local/lib/python3.6/dist-packages/monero/wallet.py", line 259, in transfer
relay=relay)
File "/usr/local/lib/python3.6/dist-packages/monero/account.py", line 97, in transfer
relay=relay)
File "/usr/local/lib/python3.6/dist-packages/monero/backends/jsonrpc.py", line 307, in transfer
_transfers = self.raw_request('transfer_split', data)
File "/usr/local/lib/python3.6/dist-packages/monero/backends/jsonrpc.py", line 324, in raw_request
self.url, headers=hdr, data=json.dumps(data), auth=auth, timeout=self.timeout)
File "/usr/local/lib/python3.6/dist-packages/requests/api.py", line 116, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.6/dist-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/requests/adapters.py", line 529, in send
raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPConnectionPool(host='127.0.0.1', port=28023): Read timed out. (read timeout=30)