qbittorrent 错误:Too many open fil

2021-09-19  本文已影响0人  夙小叶
截屏2021-09-19 09.45.31.png

⚠️ 警告:这些操作会直接影响到系统正常运行,你必须知道每一步操作所带来的后果,后面的解除限制我并没有使用过,如果你想用,请后果自负。指向的链接内的文章,我并没有全部看完,或许会有更好的解决方法。对我来说这些已经足够临时解决问题了,但你应该看完他们的讨论


检查Mac OS X系统的当前限制

launchctl limit maxfiles

#   maxfiles    256            unlimited

解决:

添加 limit.maxfiles.plist

nvim /Library/LaunchDaemons/limit.maxfiles.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  <plist version="1.0">
    <dict>
      <key>Label</key>
        <string>limit.maxfiles</string>
      <key>ProgramArguments</key>
        <array>
          <string>launchctl</string>
          <string>limit</string>
          <string>maxfiles</string>
          <string>200000</string>
          <string>200000</string>
        </array>
      <key>RunAtLoad</key>
        <true/>
      <key>ServiceIPC</key>
        <false/>
    </dict>
  </plist>

添加 limit.maxproc.plist

nvim /Library/LaunchDaemons/limit.maxproc.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
  <plist version="1.0">
    <dict>
      <key>Label</key>
        <string>limit.maxproc</string>
      <key>ProgramArguments</key>
        <array>
          <string>launchctl</string>
          <string>limit</string>
          <string>maxproc</string>
          <string>2048</string>
          <string>2048</string>
        </array>
      <key>RunAtLoad</key>
        <true />
      <key>ServiceIPC</key>
        <false />
    </dict>
  </plist>

设置权限:

sudo chmod 644 /Library/LaunchDaemons/limit.maxfiles.plist
sudo chmod 644 /Library/LaunchDaemons/limit.maxproc.plist

重新启动系统,或者执行下面的命令

sudo launchctl load -w /Library/LaunchDaemons/limit.maxfiles.plist
sudo launchctl load -w /Library/LaunchDaemons/limit.maxproc.plist
截屏2021-09-18 14.12.54.png

要改回默认值,先卸载然后再删除它们 (⚠️ 此步骤我还没用过,不确定是否存在问题)

sudo launchctl unload -w /Library/LaunchDaemons/limit.maxfiles.plist
sudo launchctl unload -w /Library/LaunchDaemons/limit.maxproc.plist

sudo rm /Library/LaunchDaemons/limit.maxfiles.plist
sudo rm /Library/LaunchDaemons/limit.maxproc.plist

2020-09-19 更新,改回默认值

不需要删除文件,只需要 unload 然后重启即可

sudo launchctl unload -w /Library/LaunchDaemons/limit.maxfiles.plist
sudo launchctl unload -w /Library/LaunchDaemons/limit.maxproc.plist

sudo launchctl list | grep max

launchctl limit maxfiles
截屏2021-09-19 11.23.46.png

如果 /Library/LaunchDaemons/limit.maxfiles.plist 值改错了,如何修复

刚开始看错文件了,把 limit.maxfiles.plist 值设置为了 2048。加载配置后,系统卡住了,所有操作都给不出反应,强制退出后登录界面无法进入

解决:

进入恢复模式(开机时按住 command + R),在终端中找到 /Library/LaunchDaemons/limit.maxfiles.plist 将值改正即可

注意,/Library/LaunchDaemons/limit.maxfiles.plist 位于 /Volumesdata 分区(Macintosh HD data) 的 /Library 目录

cd /Volumes/Macintosh HD data/Library/LaunchDaemons/

存在的问题

这两个进程出现 CPU 高占用,日志出现大量错误,电脑发热,重启无效。恢复默认值后,异常消失


上一篇 下一篇

猜你喜欢

热点阅读