Forums

An incomprehensible error from the console

Hello everyone, could you please assist me in solving this problem? I'm having trouble understanding what needs to be done.

CPU quota info: b'{"daily_cpu_limit_seconds":100,"daily_cpu_total_usage_seconds":3.053997,"next_reset_time":"2024-10-09T16:49:13"}' Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 449, in _make_request six.raise_from(e, None) File "<string>", line 3, in raise_from File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 444, in _make_request httplib_response = conn.getresponse() File "/usr/local/lib/python3.10/http/client.py", line 1374, in getresponse response.begin() File "/usr/local/lib/python3.10/http/client.py", line 318, in begin version, status, reason = self._read_status() File "/usr/local/lib/python3.10/http/client.py", line 287, in _read_status raise RemoteDisconnected("Remote end closed connection without" http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 489, in send resp = conn.urlopen( File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 785, in urlopen retries = retries.increment( File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot7395279847:AAGLIAXE28ihpJ541ye66iwGyr6OKjl2fic/getUpdates?offset=396293290&timeout=20 (Caused by ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response')))

During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/PedroUsovTG/bot/t2.py", line 112, in <module> bot.polling() File "/home/PedroUsovTG/.local/lib/python3.10/site-packages/telebot/init.py", line 1198, in polling self.__threaded_polling(non_stop=non_stop, interval=interval, timeout=timeout, long_polling_timeout=long_polling_timeout, File "/home/PedroUsovTG/.local/lib/python3.10/site-packages/telebot/init.py", line 1273, in __threaded_polling raise e File "/home/PedroUsovTG/.local/lib/python3.10/site-packages/telebot/init.py", line 1234, in threaded_polling polling_thread.raise_exceptions() File "/home/PedroUsovTG/.local/lib/python3.10/site-packages/telebot/util.py", line 111, in raise_exceptions raise self.exception_info File "/home/PedroUsovTG/.local/lib/python3.10/site-packages/telebot/util.py", line 93, in run task(args, kwargs) File "/home/PedroUsovTG/.local/lib/python3.10/site-packages/telebot/init.py", line 688, in retrieve_updates updates = self.get_updates(offset=(self.last_update_id + 1), File "/home/PedroUsovTG/.local/lib/python3.10/site-packages/telebot/init.py", line 660, in get_updates json_updates = apihelper.get_updates( File "/home/PedroUsovTG/.local/lib/python3.10/site-packages/telebot/apihelper.py", line 330, in get_updates return _make_request(token, method_url, params=payload) File "/home/PedroUsovTG/.local/lib/python3.10/site-packages/telebot/apihelper.py", line 162, in _make_request result = _get_req_session().request( File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send r = adapter.send(request, *kwargs) File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 559, in send raise ProxyError(e, request=request) requests.exceptions.ProxyError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot7395279847:AAGLIAXE28ihpJ541ye66iwGyr6OKjl2fic/getUpda tes?offset=396293290&timeout=20 (Caused by ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response')))

What were you doing?

Nothing. as far as I understand, when there are no requests to the bot, it shuts down after a while with this error. There are different shutdown times all the time.

You could add some code to catch the error and establish new connection, maybe? Or set some timeouts? It all depends on how the bot is working. Also, keep in mind that our consoles are not designed for long running jobs and they are being rebooted for maintenance. If you want to run a job continuousely on PA, use always-on tasks feature.

Now gives other error!

Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen httplib_response = self._make_request( File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 449, in _make_request six.raise_from(e, None) File "<string>", line 3, in raise_from File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 444, in _make_request httplib_response = conn.getresponse() File "/usr/local/lib/python3.10/http/client.py", line 1374, in getresponse response.begin() File "/usr/local/lib/python3.10/http/client.py", line 318, in begin version, status, reason = self._read_status() File "/usr/local/lib/python3.10/http/client.py", line 287, in _read_status raise RemoteDisconnected("Remote end closed connection without" http.client.RemoteDisconnected: Remote end closed connection without response During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 489, in send resp = conn.urlopen( File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 785, in urlopen retries = retries.increment( File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot7395279847:AAGLIAXE28ihpJ541ye66iwGyr6OKjl2fic/getUpdates?offset=396293494&timeout=20 (Caused by ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/PedroUsovTG/bot/t2.py", line 93, in <module> bot.polling(none_stop=True) File "/home/PedroUsovTG/.local/lib/python3.10/site-packages/telebot/init.py", line 1198, in polling self.threaded_polling(non_stop=non_stop, interval=interval, timeout=timeout, long_polling_timeout=long_polling_timeout, File "/home/PedroUsovTG/.local/lib/python3.10/site-packages/telebot/__init.py", line 1273, in threaded_polling raise e File "/home/PedroUsovTG/.local/lib/python3.10/site-packages/telebot/__init.py", line 1234, in threaded_polling polling_thread.raise_exceptions() File "/home/PedroUsovTG/.local/lib/python3.10/site-packages/telebot/util.py", line 111, in raise_exceptions raise self.exception_info File "/home/PedroUsovTG/.local/lib/python3.10/site-packages/telebot/util.py", line 93, in run task(args, kwargs) File "/home/PedroUsovTG/.local/lib/python3.10/site-packages/telebot/init.py", line 688, in __retrieve_updates updates = self.get_updates(offset=(self.last_update_id + 1), File "/home/PedroUsovTG/.local/lib/python3.10/site-packages/telebot/__init.py", line 660, in get_updates json_updates = apihelper.get_updates( File "/home/PedroUsovTG/.local/lib/python3.10/site-packages/telebot/apihelper.py", line 330, in get_updates return _make_request(token, method_url, params=payload) File "/home/PedroUsovTG/.local/lib/python3.10/site-packages/telebot/apihelper.py", line 162, in _make_request result = _get_req_session().request( File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send r = adapter.send(request, *kwargs) File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 559, in send raise ProxyError(e, request=request) requests.exceptions.ProxyError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot7395279847:AAGLIAXE28ihpJ541ye66iwGyr6OKjl2fic/getUpdates?offset=396293494&timeout=20 (Caused by ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response')))

Maybe have a look at this blog post and try the webhook solution.