shamhi / TapSwapBot

Bot that mines coins in Tapswap
https://t.me/tapswap_bot
295 stars 115 forks source link

[Errno 24] Too many open files #204

Open Alexell opened 3 months ago

Alexell commented 3 months ago

Прошу проверить код на корректность открытия/закрытия файлов, может где-то есть утечки дескрипоров файлов. Бота хватает на ~5 дней, потом возникает ошибка:

Error handling request
Traceback (most recent call last):
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/handler.py", line 67, in request
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/storage.py", line 93, in save_request
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/storage.py", line 99, in _save
OSError: [Errno 24] Too many open files: '/tmp/.seleniumwire/storage-85776a06-526f-4928-8461-dfda4c7f32bf/request-eb4a0e45-5c20-4b79-8b26-68f9838d7896/request'

Error handling request
Traceback (most recent call last):
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/handler.py", line 130, in response
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/storage.py", line 117, in save_response
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/storage.py", line 99, in _save
OSError: [Errno 24] Too many open files: '/tmp/.seleniumwire/storage-85776a06-526f-4928-8461-dfda4c7f32bf/request-07139bef-7fac-4289-bc4b-67dbf5461bfe/response'

Exception in thread ServerThread (('127.0.0.1', 42095)):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/thirdparty/mitmproxy/master.py", line 36, in run
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/thirdparty/mitmproxy/net/tcp.py", line 652, in serve_forever
  File "/usr/lib/python3.10/socket.py", line 293, in accept
OSError: [Errno 24] Too many open files
2024-08-06 02:24:16 | ERROR    | 105 - TapSwap | Unknown error while Login: [Errno 24] Too many open files: '/tmp/.seleniumwire/storage-85776a06-526f-4928-8461-dfda4c7f32bf/request-80843511-c0f5-42c2-8a69-35f38d4dba85/response' | Response text: ...
Error handling request
Traceback (most recent call last):
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/handler.py", line 67, in request
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/storage.py", line 93, in save_request
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/storage.py", line 99, in _save
OSError: [Errno 24] Too many open files: '/tmp/.seleniumwire/storage-77eb2720-8df2-45df-9b43-d5a68b0aad01/request-a1eed299-15df-4002-9081-aa74a9d8d1d5/request'

Exception in thread ServerThread (('127.0.0.1', 39407)):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/thirdparty/mitmproxy/master.py", line 36, in run
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/thirdparty/mitmproxy/net/tcp.py", line 652, in serve_forever
  File "/usr/lib/python3.10/socket.py", line 293, in accept
OSError: [Errno 24] Too many open files
Error handling request
Traceback (most recent call last):
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/handler.py", line 67, in request
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/storage.py", line 93, in save_request
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/storage.py", line 99, in _save
OSError: [Errno 24] Too many open files: '/tmp/.seleniumwire/storage-77eb2720-8df2-45df-9b43-d5a68b0aad01/request-1cc01659-34e4-41cf-a040-acaa2f8b4814/request'

Exception in thread ServerThread (('127.0.0.1', 37915)):
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/thirdparty/mitmproxy/master.py", line 36, in run
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/thirdparty/mitmproxy/net/tcp.py", line 652, in serve_forever
  File "/usr/lib/python3.10/socket.py", line 293, in accept
OSError: [Errno 24] Too many open files
Error handling request
Traceback (most recent call last):
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/handler.py", line 67, in request
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/storage.py", line 93, in save_request
  File "/var/www/server/crypto/TapSwapBot/tapswap-venv/lib/python3.10/site-packages/seleniumwire/storage.py", line 99, in _save
OSError: [Errno 24] Too many open files: '/tmp/.seleniumwire/storage-1a3b7697-c15f-49d5-9254-8da5c1356e14/request-024a3ff9-9acc-45c1-8110-fb5a46d44aed/request'

2024-08-06 02:25:56 | ERROR    | 105 - TapSwap | Unknown error while Login: [Errno 24] Too many open files: '/tmp/.seleniumwire/storage-1a3b7697-c15f-49d5-9254-8da5c1356e14/request-e2ea9e13-61f5-4154-8380-a6ef1031560f/response' | Response text: ...

И потом каждые несколько секунд уже такая:

ERROR    | 105 - TapSwap | Unknown error while Login: [Errno 24] Too many open files | Response text: ...
Alexell commented 3 months ago

И это при том, что у меня ulimit -n 65535