jgarzik / jgarzik/python-bitcoinrpc
bitcoinrpc.authproxy.JSONRPCException: -342: non-JSON HTTP response with '500 Internal Server Error' from server
- Vorherrschende Sprache
- Python
- Sterne
- 663
- Forks
- 300
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Hi, I'm using bitcoinrpc to fetch data using multiprocessing in python (20-40 processes at a time).
I'm frequently getting these errors:
```
exception catched by line 107: Traceback (most recent call last):
File "mainF_v2_4_blocks.py", line 66, in block_processing
block_hash = rpc1.getblockhash(block_height)
File "/home/user/btc_rpc_1/btc_rpc_venv/lib64/python3.6/site-packages/bitcoinrpc/authproxy.py", line 139, in __call__
response = self._get_response()
File "/home/user/btc_rpc_1/btc_rpc_venv/lib64/python3.6/site-packages/bitcoinrpc/authproxy.py", line 179, in _get_response
http_response = self.__conn.getresponse()
File "/usr/lib64/python3.6/http/client.py", line 1321, in getresponse
raise ResponseNotReady(self.__state)
http.client.ResponseNotReady: Request-sent
```
```
exception catched by line 107: Traceback (most recent call last):
File "mainF_v2_4_blocks.py", line 66, in block_processing
block_hash = rpc1.getblockhash(block_height)
File "/home/user/btc_rpc_1/btc_rpc_venv/lib64/python3.6/site-packages/bitcoinrpc/authproxy.py", line 136, in __call__
'Content-type': 'application/json'})
File "/usr/lib64/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib64/python3.6/http/client.py", line 1250, in _send_request
self.putrequest(method, url, **skips)
File "/usr/lib64/python3.6/http/client.py", line 1108, in putrequest
raise CannotSendRequest(self.__state)
http.client.CannotSendRequest: Request-sent
```
```
exception catched by line 107: Traceback (most recent call last):
File "mainF_v2_4_blocks.py", line 67, in block_processing
block = [json.loads(json.dumps(rpc1.getblock(block_hash), use_decimal=True))]
File "/home/user/btc_rpc_1/btc_rpc_venv/lib64/python3.6/site-packages/bitcoinrpc/authproxy.py", line 139, in __call__
response = self._get_response()
File "/home/user/btc_rpc_1/btc_rpc_venv/lib64/python3.6/site-packages/bitcoinrpc/authproxy.py", line 187, in _get_response
'code': -342, 'message': 'non-JSON HTTP response with \'%i %s\' from server' % (http_response.status, http_response.reason)})
bitcoinrpc.authproxy.JSONRPCException: -342: non-JSON HTTP response with '500 Internal Server Error' from server
```
Here is `timeout` setting my connection string:
```
rpc1 = AuthServiceProxy( "http://%s:%s@%s:%s"%(rpc_user, rpc_password, rpc_host, rpc_port), timeout=86400)
```
and entry in `bitcoin.conf`:
```
rpcthreads=400
rpcworkqueue=1600
rpcservertimeout=7200
```
What can be the cause the above error? Any suggestions how to handle it? or do I need to change timeout settings?
Thanks.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Rechercherichtung
Beginnen Sie mit bitcoinrpc/authproxy.py, insbesondere __call__ und _get_response, und verwenden Sie den gemeldeten Multiprocessing-Workload sowie die drei Python-HTTP-Ausnahmen als Reproduktionsfall. Ermitteln Sie, ob die Verbindungsfehler und die HTTP-500-Antwort durch gleichzeitige Verbindungsnutzung oder Serverlimits verursacht werden, und dokumentieren Sie anschließend eine verifizierte Anpassung der Behandlung oder Konfiguration sowie Tests, die zeigen, dass die Fehler behoben sind.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- api, backend
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100