OAI / OpenAPI-Specification

The OpenAPI Specification Repository
https://openapis.org
Apache License 2.0
29.01k stars 9.07k forks source link

`Too many files open` error in Windows #610

Closed Gopikrishna19 closed 8 years ago

Gopikrishna19 commented 8 years ago

I am using swagger and hapi to serve mock files in developing environment. I abstract parts of response to separate definitions for re-usability. I have this folder structure:

|- index.yaml // $ref to all paths.
|-paths/
| |-eachPath.yaml  // files that start with `get` property, $ref to small definitions
|-defs/
| |-eachDefs.yaml //reusuable piece of api

In windows after a certain amount of definitions and paths, when I try to start the server, not while I ping the api, I hit this error:

EMFILE: Too many files open

at random places. Once I remove certain number of files, this error is suppressed. I get this error even if I don't have hapi handler for that particular path i.e, not actually accessing the path. Just putting the file path in a index.yaml triggers the error. This does not happen in nix systems. I think it has something to do with a limit to number of files open, since windows doesn't have something like a ulimit. I have around 125 definitions (some of them reused) and 40 paths, so it would come around 200 file refs in total.

Any help would be wonderful. Thanks

webron commented 8 years ago

I'm afraid this is not quite the place for such questions as it's not related to the spec. It's more of an OS issue, perhaps also somehow related to hapi. If you suspect it's related to hapi specifically, I'd suggest opening a ticket in their support forum. Otherwise, Stackoverflow is probably your best bet.

Gopikrishna19 commented 8 years ago

Its an issue with swagger not hapi, as I mentioned. And swagger redirected me to here, that's why. I'll move this to swagger then. Thanks and apologies for any inconveniences.