V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Ayanokouji
V2EX  ›  Apple

求教: macos 如何排查 too many open files

  •  
  •   Ayanokouji · Sep 1, 2022 · 1585 views
    This topic created in 1336 days ago, the information mentioned may be changed or developed.
    lsof -Pn 输出结果没看懂,不知如何分析
    6 replies    2022-09-01 17:42:44 +08:00
    xilou31
        1
    xilou31  
       Sep 1, 2022
    什么意思,能把完整步骤说一下吗?
    too many open files 一般是连接数过多,macos 好像限制连接数最多为 2560 。
    temp178
        2
    temp178  
       Sep 1, 2022
    可能是连接数过多,比如 timeout 了没有主动关闭连接
    Ayanokouji
        3
    Ayanokouji  
    OP
       Sep 1, 2022
    @xilou31 使用 Mac 开发,突然发现服务起不来了,报错 too many open files , 想知道是哪个进程打开的文件过多
    xilou31
        4
    xilou31  
       Sep 1, 2022
    @Ayanokouji 试试 lsof -nP | awk '{print $2}' | uniq -c
    Ayanokouji
        5
    Ayanokouji  
    OP
       Sep 1, 2022
    @xilou31 看过了,排名前两个居然是 idea 和 fleet
    cat aa.txt | awk '{print $2}' | sort | uniq -c | sort -r -n | head
    Ayanokouji
        6
    Ayanokouji  
    OP
       Sep 1, 2022
    ~ launchctl limit
    cpu unlimited unlimited
    filesize unlimited unlimited
    data unlimited unlimited
    stack 8372224 67092480
    core 0 unlimited
    rss unlimited unlimited
    memlock unlimited unlimited
    maxproc 10666 16000
    maxfiles 2048 10240
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3176 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 13:42 · PVG 21:42 · LAX 06:42 · JFK 09:42
    ♥ Do have faith in what you're doing.