-
Notifications
You must be signed in to change notification settings - Fork 170
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
FD limit exceed on windows #61
Comments
Hi! I got same problem and I agree with you, we need to keep active socket in a list for Windows. |
regarding the OPTIONS handling in baresip, could you please create a separate ticket have you tried to increase I was thinking that, instead of having a fixed size table we could let the size of the table fd=500 -> size=512 a drawback here is that it would leave many unused holes in the table. |
Done (baresip/baresip#265)
Well, I have it set to 2048 which is already kind of too much. Yes' it's possible to make the limit larger, but it is useless in general for Windows does not have any limit on the return value of the So there's no reasonable limit to specify. And growing the size of |
I now agree that doubling the capacity is not a good solution :) the do you know about any other Async I/O projects that supports Windows /Alfred |
The best solution for Windows seems to be I/O Completion Ports but the design is quite different from what we have in libre. With IOCP, we don't need to maintain fd to lookup because it's possible to setup a callback when a task has been completed. https://msdn.microsoft.com/en-us/library/windows/desktop/aa365198(v=vs.85).aspx |
Hi @mikhail-barg and @GGGO would it be possible for you to try to create a patch to solve this issue? looks like there are two solutions:
/Alfred |
Another idea would be to add one layer of indirection for sockets on Windows. re would use fake fds which will be mapped to whatever fd Windows is actually using for that socket. For example:
However, if this requires similar amount of changes compared to IOCP, it's probably not worth the effort. |
@alfredh Yes, I will have to do this as we plan to use baresip stack in our production environment, but it would take some time before I could switch back to this. |
Experimental code in order to try to solve sockets for Windows. On windows the "int fd" is actually of type "SOCKET fd" and the range goes from 0 to very large. ref #61
I have made a patch that uses a list to hold the mapping between Please test it if you wish :) NOTE: the current code is very robust and mature, but with the limitation |
@alfredh thanks! We are hoping to get back to baresip-based project in near future, so that's good news for us! Still, I'm worried on the possible performance hit. Anyway, we will be looking at this soon, thanks again! |
I will reopen when we start working on this actively. /Alfred |
Hi, we are using baresip/rem/re combo on Windows, and we are facing the following issue.
If the client left in registered state for some time, the following warning starts to appear:
main: fd_listen: fd=2056 flags=0x01 - Max 2048 fds
Here's the callstack
While investigating the issue, we have discovered the following two things.
First, minor thing, is that this problem happens when handling OPTIONS message, and to handle it it opens a new
call
, which in case callsaudio_alloc()
to handle RTP sessions which seem to be completely redundant.Second, major issue, an actual cause of the problem we are facing is the way libre works with sockets. See
re\src\udp\udp.c, line 319, int udp_listen()
:and following
re\src\main\main.c, line 582, int fd_listen()
:The problem with this code is that under Windows result of
socket()
function is not a fd, and is not bound to be between 0 andFD_SETSIZE
. See here:So it seems that using sockets as ints to index some reasonable-sized array would not work under Windows at all, and some other approach should be used, like keeping list of active sockets.
The text was updated successfully, but these errors were encountered: