fix "*** buffer overflow detected ***: terminated Aborted" by adding posix poll() io implementation in addition to select() #101
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
select() API has a major drawback which doesn't allow to work with fd numbers bigger than 1024. It's a really small number nowadays as the fd table is shared between open files, sockets, connections and so on. While it might be ok for small projects it is critical for high-load projects with a lot of connections open simultaneously or for projects which work with a lot of files dealing with memcache at the same time.
Here's a quote from from first lines of documentation for select():
https://man7.org/linux/man-pages/man2/select.2.html
Here's a reproduce case:
here's result:
The PR adds option memcache.select_api which is one of poll or select (default). On Win32 only select is supported for now. While it is technically possible to implement it for win32 as it should be available starting from Windows Vista I left it for further scope as I don't have relevant expertise working with Windows APIs.