summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn DeTreville <jdetreville@vmware.com>2010-11-09 12:23:14 +0000
committerJohn DeTreville <jdetreville@vmware.com>2010-11-09 12:23:14 +0000
commitc21ac4595848c890f736b41524b97cd700cd158e (patch)
tree63241ed273377098bd8de9fad4b2e0ab25789f79
parent7ed10703eeea9379736e32cec751f23c3393aa4c (diff)
downloadrabbitmq-server-bug23351.tar.gz
Make sockets limit infinite on Windows.bug23351
-rw-r--r--src/file_handle_cache.erl15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/file_handle_cache.erl b/src/file_handle_cache.erl
index 6a948d49..9d795477 100644
--- a/src/file_handle_cache.erl
+++ b/src/file_handle_cache.erl
@@ -149,7 +149,9 @@
%% never asked to return them, and they are not managed in any way by
%% the server. It is simply a mechanism to ensure that processes that
%% need file descriptors such as sockets can do so in such a way that
-%% the overall number of open file descriptors is managed.
+%% the overall number of open file descriptors is managed. (Caution:
+%% obtain/0 should currently be used only for sockets, because of how
+%% the obtain limit is computed.)
%%
%% The callers of register_callback/3, obtain/0, and the argument of
%% transfer/1 are monitored, reducing the count of handles in use
@@ -820,7 +822,16 @@ init([]) ->
Lim -> lists:max([2, Lim - ?RESERVED_FOR_OTHERS])
end
end,
- ObtainLimit = obtain_limit(Limit),
+ ObtainLimit = case os:type() of
+ {win32, _OsName} ->
+ %% Obtains are used only for sockets, and the Windows
+ %% implementation has no limit on sockets.
+ infinity;
+ _ ->
+ %% Non-Windows systems are the normal case; socket
+ %% limits are included in the regular limits.
+ obtain_limit(Limit)
+ end,
error_logger:info_msg("Limiting to approx ~p file handles (~p sockets)~n",
[Limit, ObtainLimit]),
Clients = ets:new(?CLIENT_ETS_TABLE, [set, private, {keypos, #cstate.pid}]),