mitmdump error: too many file descriptors in select() issue in windows

mitmdump error: too many file descriptors in select() issue in windows

我尝试使用 mitmdump 和 python 脚本捕获 Android 应用程序上的请求,但 mitmdump 似乎很容易被阻止并抛出以下错误:

Traceback (most recent call last):
  File "D:\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\Python\Python39\Scripts\mitmdump.exe\__main__.py", line 7, in <module>
  File "D:\Python\Python39\lib\site-packages\mitmproxy\tools\main.py", line 147, in mitmdump
    m = run(dump.DumpMaster, cmdline.mitmdump, args, extra)
  File "D:\Python\Python39\lib\site-packages\mitmproxy\tools\main.py", line 114, in run
    master.run()
  File "D:\Python\Python39\lib\site-packages\mitmproxy\master.py", line 81, in run
    self.run_loop(loop.run_forever)
  File "D:\Python\Python39\lib\site-packages\mitmproxy\master.py", line 64, in run_loop
    self.shutdown()
  File "D:\Python\Python39\lib\site-packages\mitmproxy\master.py", line 100, in shutdown
    self.event_loop.run_until_complete(asyncio.wrap_future(ret))
  File "D:\Python\Python39\lib\asyncio\base_events.py", line 629, in run_until_complete
    self.run_forever()
  File "D:\Python\Python39\lib\asyncio\base_events.py", line 596, in run_forever
    self._run_once()
  File "D:\Python\Python39\lib\asyncio\base_events.py", line 1854, in _run_once
    event_list = self._selector.select(timeout)
  File "D:\Python\Python39\lib\selectors.py", line 324, in select
    r, w, _ = self._select(self._readers, self._writers, [], timeout)
  File "D:\Python\Python39\lib\selectors.py", line 315, in _select
    r, w, x = select.select(r, w, w, timeout)
ValueError: too many file descriptors in select()

mitmdump 服务器在 windows 中 运行。貌似限制了mitmdump的并发,但是不知道怎么修改源码code.Could有大神分享一下吗?

最新的开发版本(最终将是 8.0)在 Windows 上使用 ProactorEventLoop,它解决了这个问题。

现在您可以减少并发连接数,或者升级到开发快照。