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

too many open files ? #983

Closed
4 tasks done
remisharrock opened this issue Nov 20, 2023 · 50 comments
Closed
4 tasks done

too many open files ? #983

remisharrock opened this issue Nov 20, 2023 · 50 comments
Labels
help wanted Extra attention is needed more information needed Further information is requested needs investigation

Comments

@remisharrock
Copy link

Have you checked our README?

  • I have checked the README

Have you followed our Troubleshooting?

  • I have followed your Troubleshooting

Is there already an issue for your problem?

  • I have checked older issues, open and closed

Have you checked the discussions?

  • I have read the Discussions

Environment

- FlareSolverr version: 3.3.9
- Last working FlareSolverr version: 3.3.9
- Operating system: Debian 12
- Are you using Docker: [yes/no] no 
- FlareSolverr User-Agent (see log traces or / endpoint): Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
- Are you using a VPN: [yes/no] no
- Are you using a Proxy: [yes/no] no
- Are you using Captcha Solver: [yes/no] no
- If using captcha solver, which one:
- URL to test this issue:

Description

after a few days of correct functionning, I get the error "internal server error" with "Too many open files"

Logged Error Messages

Nov 20 13:27:50 prowlarr flaresolverr[315582]: 2023-11-20 13:27:50 INFO     192.168.1.111 GET http://192.168.1.207:8191/ 200 OK
Nov 20 13:40:58 prowlarr flaresolverr[315582]: 2023-11-20 13:40:58 INFO     Incoming request => POST /v1 body: {'maxTimeout': 60000, 'cmd': 'request.get', 'url': 'https://www
3.yggtorrent.wtf/engine/search?category=all&do=search&order=desc&sort=publish_date', 'proxy': {}}
Nov 20 13:40:58 prowlarr flaresolverr[315582]: 2023-11-20 13:40:58 ERROR    Error: Error solving the challenge. [Errno 24] Too many open files
Nov 20 13:40:58 prowlarr flaresolverr[315582]: 2023-11-20 13:40:58 INFO     Response in 0.033 s
Nov 20 13:40:58 prowlarr flaresolverr[315582]: 2023-11-20 13:40:58 INFO     127.0.0.1 POST http://localhost:8191/v1 500 Internal Server Error
Nov 20 13:42:50 prowlarr flaresolverr[315582]: 2023-11-20 13:42:50 INFO     192.168.1.111 GET http://192.168.1.207:8191/ 200 OK
Nov 20 13:56:26 prowlarr flaresolverr[315582]: 2023-11-20 13:56:26 INFO     Incoming request => POST /v1 body: {'maxTimeout': 60000, 'cmd': 'request.get', 'url': 'https://www
3.yggtorrent.wtf/engine/search?category=all&do=search&order=desc&sort=publish_date', 'proxy': {}}
Nov 20 13:56:26 prowlarr flaresolverr[315582]: 2023-11-20 13:56:26 ERROR    Error: Error solving the challenge. [Errno 24] Too many open files
Nov 20 13:56:26 prowlarr flaresolverr[315582]: 2023-11-20 13:56:26 INFO     Response in 0.021 s
Nov 20 13:56:26 prowlarr flaresolverr[315582]: 2023-11-20 13:56:26 INFO     127.0.0.1 POST http://localhost:8191/v1 500 Internal Server Error
Nov 20 13:57:50 prowlarr flaresolverr[315582]: 2023-11-20 13:57:50 INFO     192.168.1.111 GET http://192.168.1.207:8191/ 200 OK
Nov 20 14:12:50 prowlarr flaresolverr[315582]: 2023-11-20 14:12:50 INFO     192.168.1.111 GET http://192.168.1.207:8191/ 200 OK
Nov 20 14:27:26 prowlarr flaresolverr[315582]: 2023-11-20 14:27:26 INFO     Incoming request => POST /v1 body: {'maxTimeout': 60000, 'cmd': 'request.get', 'url': 'https://www
3.yggtorrent.wtf/engine/search?category=all&do=search&order=desc&sort=publish_date', 'proxy': {}}
Nov 20 14:27:26 prowlarr flaresolverr[315582]: 2023-11-20 14:27:26 ERROR    Error: Error solving the challenge. [Errno 24] Too many open files
Nov 20 14:27:26 prowlarr flaresolverr[315582]: 2023-11-20 14:27:26 INFO     Response in 0.022 s
Nov 20 14:27:26 prowlarr flaresolverr[315582]: 2023-11-20 14:27:26 INFO     127.0.0.1 POST http://localhost:8191/v1 500 Internal Server Error
Nov 20 14:27:50 prowlarr flaresolverr[315582]: 2023-11-20 14:27:50 INFO     192.168.1.111 GET http://192.168.1.207:8191/ 200 OK
Nov 20 14:42:50 prowlarr flaresolverr[315582]: 2023-11-20 14:42:50 INFO     192.168.1.111 GET http://192.168.1.207:8191/ 200 OK
Nov 20 14:57:50 prowlarr flaresolverr[315582]: 2023-11-20 14:57:50 INFO     192.168.1.111 GET http://192.168.1.207:8191/ 200 OK
Nov 20 15:12:50 prowlarr flaresolverr[315582]: 2023-11-20 15:12:50 INFO     192.168.1.111 GET http://192.168.1.207:8191/ 200 OK
Nov 20 15:27:50 prowlarr flaresolverr[315582]: 2023-11-20 15:27:50 INFO     192.168.1.111 GET http://192.168.1.207:8191/ 200 OK
Nov 20 15:42:50 prowlarr flaresolverr[315582]: 2023-11-20 15:42:50 INFO     192.168.1.111 GET http://192.168.1.207:8191/ 200 OK
Nov 20 15:44:58 prowlarr flaresolverr[315582]: 2023-11-20 15:44:58 INFO     Incoming request => POST /v1 body: {'maxTimeout': 60000, 'cmd': 'request.get', 'url': 'https://www
3.yggtorrent.wtf/engine/search?category=all&do=search&order=desc&sort=publish_date', 'proxy': {}}
Nov 20 15:44:58 prowlarr flaresolverr[315582]: 2023-11-20 15:44:58 ERROR    Error: Error solving the challenge. [Errno 24] Too many open files
Nov 20 15:44:58 prowlarr flaresolverr[315582]: 2023-11-20 15:44:58 INFO     Response in 0.026 s
Nov 20 15:44:58 prowlarr flaresolverr[315582]: 2023-11-20 15:44:58 INFO     127.0.0.1 POST http://localhost:8191/v1 500 Internal Server Error
Nov 20 15:57:51 prowlarr flaresolverr[315582]: 2023-11-20 15:57:51 INFO     192.168.1.111 GET http://192.168.1.207:8191/ 200 OK
Nov 20 16:12:51 prowlarr flaresolverr[315582]: 2023-11-20 16:12:51 INFO     192.168.1.111 GET http://192.168.1.207:8191/ 200 OK
Nov 20 16:27:51 prowlarr flaresolverr[315582]: 2023-11-20 16:27:51 INFO     192.168.1.111 GET http://192.168.1.207:8191/ 200 OK

Screenshots

No response

@ilike2burnthing
Copy link
Contributor

Are there any zombie processes? If no, check the current ulimit and play around with it.

@ilike2burnthing ilike2burnthing added the more information needed Further information is requested label Nov 21, 2023
@LaCartouche
Copy link

Hello, I have the same problem. After a few days I see this in the logs

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/local/lib/python3.11/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/app/undetected_chromedriver/dprocess.py", line 60, in _start_detached
    p = Popen([executable, *args], stdin=PIPE, stdout=PIPE, stderr=PIPE, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/subprocess.py", line 992, in __init__
    errread, errwrite) = self._get_handles(stdin, stdout, stderr)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/subprocess.py", line 1728, in _get_handles
    errread, errwrite = os.pipe()
                        ^^^^^^^^^
OSError: [Errno 24] Too many open files

As soon as this happens all requests will fail until I reboot the container.

I do not see any zombie processes

USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
flareso+       1  0.0  0.0   2232   548 ?        Ss   12:05   0:00 /usr/bin/dumb-init -- /usr/local/bin/python -u /app/flaresolverr.py
flareso+       7  0.0  0.2 420748 94792 pts/0    Ssl+ 12:05   0:04 /usr/local/bin/python -u /app/flaresolverr.py
flareso+      25  0.0  0.0  23660 13600 pts/0    S+   12:06   0:00 Xvfb :1270133183 -screen 0 800x680x24
flareso+     753  0.0  0.0   6052  3644 pts/1    Ss+  17:19   0:00 bash
flareso+     766  0.0  0.0   6052  3556 pts/2    Ss+  17:22   0:00 bash
flareso+     772  0.0  0.0   6052  3584 pts/3    Ss+  17:23   0:00 bash
flareso+     778  0.0  0.0   6052  3636 pts/4    Ss+  17:25   0:00 bash
flareso+     784  0.0  0.0   6052  3532 pts/5    Ss+  17:26   0:00 bash
flareso+     790  0.0  0.0   6052  3632 pts/6    Ss+  17:28   0:00 bash
flareso+     799  0.0  0.0   6052  3556 pts/7    Ss+  17:41   0:00 bash
flareso+     806  0.0  0.0   6052  3652 pts/8    Ss   17:44   0:00 bash
flareso+     813  0.0  0.0   8648  3140 pts/8    R+   17:45   0:00 ps ux

@ilike2burnthing
Copy link
Contributor

If no, check the current ulimit and play around with it.

@GregKarabinos
Copy link

I'm also having this problem.

@LaCartouche
Copy link

I updated my open files limit with

ulimit -n 64000

Will give feedback in a few days if the problem happens again.

@remisharrock
Copy link
Author

remisharrock commented Dec 9, 2023

I still the same problem.

Error: Error solving the challenge. [Errno 24] Too many open files

no zombie processes

ps -aux | grep Z
USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      650961  0.0  0.1   3324  1536 pts/1    S+   16:34   0:00 grep Z
root@prowlarr:~# 

no limits:

ulimit
unlimited

cat /proc/sys/fs/file-max
9223372036854775807
root@prowlarr:~# ulimit -Hn
1048576
root@prowlarr:~# ulimit -Sn
1024
root@prowlarr:~# cat /proc/sys/fs/file-max
9223372036854775807

Only way is to restart the service I created with :

cat /etc/systemd/system/flaresolverr.service 
[Unit]
Description=Flaresolverr Service
After=network.target

[Service]
Type=simple
ExecStart=/root/flaresolverr/flaresolverr
Restart=always

[Install]
WantedBy=multi-user.target

any idea how I can get more info to debug ?

@ilike2burnthing ilike2burnthing added help wanted Extra attention is needed needs investigation and removed more information needed Further information is requested labels Dec 10, 2023
@ilike2burnthing
Copy link
Contributor

See if v3.3.11 makes a difference.

@RedBuld
Copy link

RedBuld commented Dec 16, 2023

to fix just add

process.close()

in file undetected_chromedriver/dprocess.py after reader.close()

This is because Python stores the process metadata even after it terminates

@ilike2burnthing
Copy link
Contributor

If those above can test and confirm this is working, I'll add it in the next release.

@LaCartouche
Copy link

Which version can we install to test this fix ?

@ilike2burnthing
Copy link
Contributor

Run from source - https://github.com/FlareSolverr/FlareSolverr#from-source-code

Or if using Docker, edit the file in the container and restart.

@ilike2burnthing ilike2burnthing added the more information needed Further information is requested label Dec 17, 2023
@remisharrock
Copy link
Author

For now I have installed 3.3.12 because I'm in a lightweight headless LXC container running flaresolverr binary distribution and I don't want to pollute this container by installing chrome and all it's dependencies just to run the source version of flaresolverr. I might try in the future in another container. Anyway if you think the process should be closed at that point why not doing process.close() ? Maybe you have a reason, I did not look at the source code yet ?

@ilike2burnthing
Copy link
Contributor

As I can't reproduce the issue I can't test if this resolves it.

@LaCartouche
Copy link

I adapted the code as suggested. As this problem only occurs after a few days I'll give you a feedback when relevant (did the change yesterday).

@RedBuld
Copy link

RedBuld commented Dec 18, 2023

Easy way to reproduce - use windows version, because of 512 MOF in windows, just send 515 requests.
Also good variant to remove PIPE from Popen in same file. I use modified and compiled version around 4 day for my TG bot

@RedBuld
Copy link

RedBuld commented Dec 18, 2023

Anyway if you think the process should be closed at that point why not doing process.close() ? Maybe you have a reason, I did not look at the source code yet ?

It's original undetected_cromedriver package, which rarely updates

@ilike2burnthing
Copy link
Contributor

It's original undetected_cromedriver package, which rarely updates

There are a few modifications, but yes, 99.9% of UC is untouched.

@Jonathall
Copy link

As I can't reproduce the issue I can't test if this resolves it.

I also change the code as suggested déc 22 on version 3.3.12 normaly the error occur 4/5 days after container start and never reach 1 week of uptime so i will update you next week if it solve

@RedBuld
Copy link

RedBuld commented Dec 23, 2023

Got TMOF, but time to error enlarged from 1 day to 2 days with ~ same amount of requests per day

@LaCartouche
Copy link

After 6 days, not a single failure :). It usually started failing after 2, 3 days for me.

@chnob
Copy link

chnob commented Dec 27, 2023

Hi the team, do you know when the app will be updated? I have a Docker version and I don't quite understand how to change the parameter to overcome this problem ^^' thks U

@RedBuld
Copy link

RedBuld commented Dec 27, 2023

@LaCartouche how are your instance of Flaresolver working? Did you have any issues?

@LaCartouche
Copy link

I just took a second look at my logs. It is all working BUT I think Yggtorrent disabled their captcha verification. From the logs:

2023-12-27 12:34:53 INFO Challenge not detected!
2023-12-27 12:34:53 INFO Response in 3.352 s
2023-12-27 12:34:53 INFO 192.168.88.140 POST http://192.168.88.105:8191/v1 200 OK
2023-12-27 12:35:08 INFO Incoming request => POST /v1 body: {'cmd': 'request.get', 'url': 'https://www3.yggtorrent.qa/engine/search?category=all&do=search&order=desc&sort=publish_date', 'maxTimeout': 60000}

If there is no captcha to solve I don't know if the undetected_chromedriver is used or not (I guess not ?). Which would then explain why I have no issues anymore and invalidate my testing.

@ilike2burnthing
Copy link
Contributor

Any time the container is redeployed, this would need to be repeated.

@LaCartouche
Copy link

I still have the "too many open files" issue even with the suggested fix.

@LaCartouche
Copy link

FlareSolverr_logs.txt

Here's the log of my last test with a container that was just restarted and with the suggested fix applied.

335 requests until the "OSError: [Errno 24] Too many open files"

@Jonathall
Copy link

9 days and still up
image
No challenge for the moment so i dont know how it impact the test
is it still up because no challenge or because of the fix

@ilike2burnthing
Copy link
Contributor

iDope, TorrentQQ, and Torrent[CORE] are all public indexers with Cloudflare challenges, you could add them, configure them with Sonarr/Radarr/whatever you're using, see if the issue continues.

@Jonathall
Copy link

Added one with a challenge i will keep you updated

@Jonathall
Copy link

ok Now 6 Days with this fix and still up with challenge solved every 30 min
so for now I see improvement.

@ilike2burnthing
Copy link
Contributor

v3.3.13

@Jonathall
Copy link

ok issue happend today again but after 7 days compared to the usual 4 /5days so around 50% improvement

Process Process-336:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
self.run()
File "/usr/local/lib/python3.11/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/app/undetected_chromedriver/dprocess.py", line 60, in _start_detached
p = Popen([executable, *args], stdin=PIPE, stdout=PIPE, stderr=PIPE, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/subprocess.py", line 1026, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/local/lib/python3.11/subprocess.py", line 1849, in _execute_child
errpipe_read, errpipe_write = os.pipe()
^^^^^^^^^
OSError: [Errno 24] Too many open files
2024-01-07 20:34:34 INFO Incoming request => POST /v1 body: {'maxTimeout': 60000, 'cmd': 'request.get', 'url': 'https://idope.se/browse.html', 'proxy': {}}
version_main cannot be converted to an integer
Process Process-337:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
self.run()
File "/usr/local/lib/python3.11/multiprocessing/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/app/undetected_chromedriver/dprocess.py", line 60, in _start_detached
p = Popen([executable, *args], stdin=PIPE, stdout=PIPE, stderr=PIPE, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/subprocess.py", line 992, in init
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/subprocess.py", line 1713, in _get_handles
c2pread, c2pwrite = os.pipe()
^^^^^^^^^
OSError: [Errno 24] Too many open files

@Jonathall
Copy link

ok i have run lsof in the container and im flooded with this for maybe a thousand line
so the too many open file are those files...
if it can help someone figure out the root cause

python 7 flaresolverr 11u IPv4 4261517 0t0 TCP flaresolverr:8191->10.10.7.4:40246 (CLOSE_WAIT)
python 7 flaresolverr 12w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 13u IPv4 41874 0t0 TCP localhost:59564->localhost:52351 (CLOSE_WAIT)
python 7 flaresolverr 14w FIFO 0,11 0t0 41837 pipe
python 7 flaresolverr 15w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 16u IPv4 48701 0t0 TCP localhost:33766->localhost:51125 (CLOSE_WAIT)
python 7 flaresolverr 17w FIFO 0,11 0t0 48490 pipe
python 7 flaresolverr 18w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 19u IPv4 57378 0t0 TCP localhost:45904->localhost:58141 (CLOSE_WAIT)
python 7 flaresolverr 20w FIFO 0,11 0t0 56550 pipe
python 7 flaresolverr 21w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 22u IPv4 184693 0t0 TCP localhost:38714->localhost:34969 (CLOSE_WAIT)
python 7 flaresolverr 23w FIFO 0,11 0t0 183010 pipe
python 7 flaresolverr 24w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 25u IPv4 211340 0t0 TCP localhost:39782->localhost:43477 (CLOSE_WAIT)
python 7 flaresolverr 26w FIFO 0,11 0t0 211064 pipe
python 7 flaresolverr 27w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 28u IPv4 212906 0t0 TCP localhost:50080->localhost:45817 (CLOSE_WAIT)
python 7 flaresolverr 29w FIFO 0,11 0t0 212515 pipe
python 7 flaresolverr 30w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 31u IPv4 219370 0t0 TCP localhost:40878->localhost:57109 (CLOSE_WAIT)
python 7 flaresolverr 32w FIFO 0,11 0t0 214918 pipe
python 7 flaresolverr 33w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 34u IPv4 228199 0t0 TCP localhost:41388->localhost:41735 (CLOSE_WAIT)
python 7 flaresolverr 35w FIFO 0,11 0t0 227802 pipe
python 7 flaresolverr 36w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 36w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 37u IPv4 230116 0t0 TCP localhost:37296->localhost:59205 (CLOSE_WAIT)
python 7 flaresolverr 38w FIFO 0,11 0t0 229089 pipe
python 7 flaresolverr 39w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 40u IPv4 239493 0t0 TCP localhost:46254->localhost:38037 (CLOSE_WAIT)
python 7 flaresolverr 41w FIFO 0,11 0t0 239304 pipe
python 7 flaresolverr 42w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 43u IPv4 244216 0t0 TCP localhost:56268->localhost:48171 (CLOSE_WAIT)
python 7 flaresolverr 44w FIFO 0,11 0t0 243864 pipe
python 7 flaresolverr 45w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 46u IPv4 252999 0t0 TCP localhost:58424->localhost:47015 (CLOSE_WAIT)
python 7 flaresolverr 47w FIFO 0,11 0t0 249578 pipe
python 7 flaresolverr 48w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 49u IPv4 263290 0t0 TCP localhost:44392->localhost:42239 (CLOSE_WAIT)
python 7 flaresolverr 50w FIFO 0,11 0t0 259948 pipe
python 7 flaresolverr 51w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 52u IPv4 274233 0t0 TCP localhost:52824->localhost:50373 (CLOSE_WAIT)
python 7 flaresolverr 53w FIFO 0,11 0t0 273930 pipe
python 7 flaresolverr 54w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 55u IPv4 287279 0t0 TCP localhost:42020->localhost:43949 (CLOSE_WAIT)
python 7 flaresolverr 56w FIFO 0,11 0t0 285138 pipe
python 7 flaresolverr 57w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 58u IPv4 301789 0t0 TCP localhost:47904->localhost:51751 (CLOSE_WAIT)
python 7 flaresolverr 59w FIFO 0,11 0t0 301478 pipe
python 7 flaresolverr 60w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 61u IPv4 324473 0t0 TCP localhost:42720->localhost:58675 (CLOSE_WAIT)
python 7 flaresolverr 62w FIFO 0,11 0t0 325684 pipe
python 7 flaresolverr 63w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 64u IPv4 338649 0t0 TCP localhost:39956->localhost:59051 (CLOSE_WAIT)
python 7 flaresolverr 65w FIFO 0,11 0t0 338123 pipe
python 7 flaresolverr 66w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 67u IPv4 352857 0t0 TCP localhost:37214->localhost:44119 (CLOSE_WAIT)
python 7 flaresolverr 68w FIFO 0,11 0t0 352481 pipe
python 7 flaresolverr 69w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 70u IPv4 368303 0t0 TCP localhost:41168->localhost:50885 (CLOSE_WAIT)
python 7 flaresolverr 71w FIFO 0,11 0t0 366556 pipe
python 7 flaresolverr 72w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 73u IPv4 371400 0t0 TCP localhost:39790->localhost:43611 (CLOSE_WAIT)
python 7 flaresolverr 74w FIFO 0,11 0t0 371194 pipe
python 7 flaresolverr 75w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 76u IPv4 384478 0t0 TCP localhost:36778->localhost:44447 (CLOSE_WAIT)
python 7 flaresolverr 77w FIFO 0,11 0t0 383212 pipe
python 7 flaresolverr 78w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 79u IPv4 420924 0t0 TCP localhost:33830->localhost:47599 (CLOSE_WAIT)
python 7 flaresolverr 80w FIFO 0,11 0t0 418434 pipe
python 7 flaresolverr 81w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 82u IPv4 434517 0t0 TCP localhost:36312->localhost:51579 (CLOSE_WAIT)
python 7 flaresolverr 83w FIFO 0,11 0t0 433455 pipe
python 7 flaresolverr 84w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 85u IPv4 446454 0t0 TCP localhost:45048->localhost:59515 (CLOSE_WAIT)
python 7 flaresolverr 86w FIFO 0,11 0t0 448583 pipe
python 7 flaresolverr 87w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 88u IPv4 485529 0t0 TCP localhost:48326->localhost:36721 (CLOSE_WAIT)

@RedBuld
Copy link

RedBuld commented Jan 9, 2024

Additional fix in file /undetected_chromedriver/dprocess.py on line 61 change
from

p = Popen([executable, *args], stdin=PIPE, stdout=PIPE, stderr=PIPE, **kwargs)

to

p = Popen([executable, *args], stdin=None, stdout=None, stderr=None, **kwargs)

this have no impact on workflow, but reduce pipes usage, which usage lead to TMOF

@ilike2burnthing
Copy link
Contributor

You know the drill people, test and let me know ;)

@LaCartouche
Copy link

Tried this new suggestion and started 2000 calls. I still have the same problem.

Started from a fresh container, I had around 50 open files at startup. After running my test I'm stuck at 5197 open files.
Out of these, 5144 are variations of this error:

python 7 169 python flaresolverr 1009 unknown /proc/7/task/169/fd/1009 (readlink: Permission denied)

@LaCartouche
Copy link

LaCartouche commented Jan 9, 2024

My slow brain realized I had to switch to the python user...

It's actually a variation of this line:

python 7 169 python flaresolverr 877u IPv4 4359744 0t0 TCP localhost:46236->localhost:54065 (CLOSE_WAIT)
python 7 169 python flaresolverr 878w FIFO 0,13 0t0 4358334 pipe
python 7 169 python flaresolverr 879w CHR 1,3 0t0 5 /dev/null

@Jonathall
Copy link

May have something to do with the usage of kill while multiprocessing was starter so they become orphan
Screenshot_20240110_121627_Brave

@Jonathall
Copy link

ok found that the owner of all those file seam to be flaresolverr.py
those package of open file are open by process 7
python 7 flaresolverr 12w CHR 1,3 0t0 5 /dev/null
python 7 flaresolverr 13u IPv4 7465067 0t0 TCP localhost:42260->localhost:48683 (CLOSE_WAIT)
python 7 flaresolverr 14w FIFO 0,11 0t0 7461622 pipe

and this is the process 7
flareso+ 7 0.1 0.3 420792 62112 ? Ssl 03:57 0:00 /usr/local/bin/python -u /app/flaresolverr.py

hope it help to narrow the issue

@Jonathall
Copy link

Jonathall commented Jan 13, 2024

ok cut 1/3 of those file
in init.py
keep_alive=True change to False

got rid of those : python 7 flaresolverr 13u IPv4 7465067 0t0 TCP localhost:42260->localhost:48683 (CLOSE_WAIT)

so now only have those
python 7 flaresolverr 23w FIFO 0,11 0t0 7688926 pipe
python 7 flaresolverr 24w CHR 1,3 0t0 5 /dev/null

i think its the fact to kill trhe detached browser from the outside that create this
im not a python pro but probably sending signal and catch it to call a quit would be more clean

@ilike2burnthing
Copy link
Contributor

Please test proposed fix - ultrafunkamsterdam/undetected-chromedriver#1812.

@Jonathall
Copy link

it work made the change run a bunch of solving test and I'm not spammed by open file
so the fix is adding the 2
line described

Thanks

@ilike2burnthing
Copy link
Contributor

If someone else can confirm this as well (@LaCartouche maybe?), then I'll add it.

@Jonathall
Copy link

this is with the fix
image
image

this is without fix after only few solve
image

@denzovirus
Copy link

I can confirm after modifying the init.py file with the two lines suggested. I no longer have any "too many open files" errors. many thanks

@ilike2burnthing
Copy link
Contributor

v3.3.17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed more information needed Further information is requested needs investigation
Projects
None yet
Development

No branches or pull requests

8 participants