Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Keep working when EMFILE is reached #2158

Merged
merged 2 commits into from
Feb 9, 2022

Conversation

steve-chavez
Copy link
Member

@steve-chavez steve-chavez commented Feb 7, 2022

Closes #2042.

TODO

@wolfgangwalther
Copy link
Member

Do you think we can craft an io test that runs into the EMFILE problem without the patch?

@steve-chavez
Copy link
Member Author

We'd be testing Warp if we do that, so I think we shouldn't. However, basically we need to dynamically change the file descriptor limit(can be done with prlimit) to something like 1, make requests and see postgrest fail.

@steve-chavez
Copy link
Member Author

make requests and see postgrest fail.

Doing a prlimit --pid <pid> --nofile=10:1024 and making a new request:

  • old version: postgrest dies and prints the Network.Socket.accept: resource exhausted (Too many open files) error.
  • new version: new requests wait and when increasing the fds(prlimit --pid <pid> --nofile=1024:1024) they get a response.

(Ideally the EMFILE error would bubble up to the client instead of waiting but at least we keep running)

@steve-chavez
Copy link
Member Author

The above looks like a recovery test, so I've listed it on #1766 to add it later if it's worth it.

@wolfgangwalther
Copy link
Member

(Ideally the EMFILE error would bubble up to the client instead of waiting but at least we keep running)

Agree with both!

@steve-chavez steve-chavez merged commit 9021c96 into PostgREST:main Feb 9, 2022
laurenceisla pushed a commit to laurenceisla/postgrest that referenced this pull request May 31, 2022
laurenceisla pushed a commit to laurenceisla/postgrest that referenced this pull request Jun 1, 2022
laurenceisla pushed a commit to laurenceisla/postgrest that referenced this pull request Jun 2, 2022
laurenceisla pushed a commit to laurenceisla/postgrest that referenced this pull request Jun 3, 2022
steve-chavez added a commit that referenced this pull request Jun 4, 2022
Done by upgrading to warp 3.3.19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Network.Socket.accept: resource exhausted (Too many open files)
2 participants