zhaofengli / attic

Multi-tenant Nix Binary Cache
https://docs.attic.rs
Other
1.04k stars 79 forks source link

Error during watch: Too many open files (macOS) #107

Open fasterthanlime opened 10 months ago

fasterthanlime commented 10 months ago

When running attic watch-store main on my macOS machine, it's stuck for a minute, and then it spams:

Error during watch: Error { kind: Io(Os { code: 24, kind: Uncategorized, message: "Too many open files" }), paths: [] }
Error during watch: Error { kind: Io(Os { code: 24, kind: Uncategorized, message: "Too many open files" }), paths: [] }
Error during watch: Error { kind: Io(Os { code: 24, kind: Uncategorized, message: "Too many open files" }), paths: [] }
Error during watch: Error { kind: Io(Os { code: 24, kind: Uncategorized, message: "Too many open files" }), paths: [] }
Error during watch: Error { kind: Io(Os { code: 24, kind: Uncategorized, message: "Too many open files" }), paths: [] }
Error during watch: Error { kind: Io(Os { code: 24, kind: Uncategorized, message: "Too many open files" }), paths: [] }
Error during watch: Error { kind: Io(Os { code: 24, kind: Uncategorized, message: "Too many open files" }), paths: [] }

..while not actually pushing anything.

The same version of attic works fine on a (remote) Linux machine.

dbaynard commented 7 months ago

I'm not an attic user (yet) but I hit similar issues with nix a while ago — I was trying to build a nix-darwin system.

> launchctl limit maxfiles
        maxfiles    256            unlimited

> ulimit -n
256

I think setting this helped — I was able to complete the build, having set it, but I haven't confirmed it was the direct fix.

ulimit -n 10240

Hopefully this may help someone affected by the issue.

Some resources:

kradalby commented 5 months ago

I'm running into this on macOS aswell, I've set ulimit to max, which is 65536 it seems, and sadly still running into it. I'm unsure if there is any good fix available if your Nix store is too big...