Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Every time httpcore._exceptions.ProtocolError: <ConnectionTerminated error_code:ErrorCodes.COMPRESSION_ERROR appears, the service CPU usage will surge #425

Open
xsw302 opened this issue Nov 18, 2024 · 0 comments

Comments

@xsw302
Copy link

xsw302 commented Nov 18, 2024

Googletrans version:
4.0.0rc1

Every time httpcore._exceptions.ProtocolError: <ConnectionTerminated error_code:ErrorCodes.COMPRESSION_ERROR appears, the service CPU usage will surge. I suspect that it is an attack from Google Translate.

Does anyone have a solution?

The stack is as follows:
Traceback (most recent call last):
File "/app/utils/translate.py", line 16, in translate
resp = ts.translate(text=text)
File "/usr/local/lib/python3.7/site-packages/googletrans/client.py", line 194, in translate
data, response = self._translate(text, dest, src)
File "/usr/local/lib/python3.7/site-packages/googletrans/client.py", line 120, in _translate
r = self.client.post(url, params=params, data=data)
File "/usr/local/lib/python3.7/site-packages/httpx/_client.py", line 835, in post
timeout=timeout,
File "/usr/local/lib/python3.7/site-packages/httpx/_client.py", line 601, in request
request, auth=auth, allow_redirects=allow_redirects, timeout=timeout,
File "/usr/local/lib/python3.7/site-packages/httpx/_client.py", line 621, in send
request, auth=auth, timeout=timeout, allow_redirects=allow_redirects,
File "/usr/local/lib/python3.7/site-packages/httpx/_client.py", line 648, in send_handling_redirects
request, auth=auth, timeout=timeout, history=history
File "/usr/local/lib/python3.7/site-packages/httpx/_client.py", line 684, in send_handling_auth
response = self.send_single_request(request, timeout)
File "/usr/local/lib/python3.7/site-packages/httpx/_client.py", line 719, in send_single_request
timeout=timeout.as_dict(),
File "/usr/local/lib/python3.7/site-packages/httpcore/_sync/connection_pool.py", line 153, in request
method, url, headers=headers, stream=stream, timeout=timeout
File "/usr/local/lib/python3.7/site-packages/httpcore/_sync/connection.py", line 78, in request
return self.connection.request(method, url, headers, stream, timeout)
File "/usr/local/lib/python3.7/site-packages/httpcore/_sync/http2.py", line 118, in request
return h2_stream.request(method, url, headers, stream, timeout)
File "/usr/local/lib/python3.7/site-packages/httpcore/_sync/http2.py", line 292, in request
status_code, headers = self.receive_response(timeout)
File "/usr/local/lib/python3.7/site-packages/httpcore/_sync/http2.py", line 344, in receive_response
event = self.connection.wait_for_event(self.stream_id, timeout)
File "/usr/local/lib/python3.7/site-packages/httpcore/_sync/http2.py", line 197, in wait_for_event
self.receive_events(timeout)
File "/usr/local/lib/python3.7/site-packages/httpcore/_sync/http2.py", line 211, in receive_events
raise ProtocolError(event)
httpcore._exceptions.ProtocolError: <ConnectionTerminated error_code:ErrorCodes.COMPRESSION_ERROR, last_stream_id:7, additional_data:687061636b5f696e76616c69645f696e646578>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant