From 192440ab1fdad0f3924f7af8c6f0dbc4f47f70b1 Mon Sep 17 00:00:00 2001
From: Lukas Larsson
Date: Mon, 25 Feb 2013 15:38:55 +0100
Subject: Set default max ports on win32 to 8192
---
erts/doc/src/erl.xml | 2 ++
erts/emulator/beam/erl_port.h | 11 +++++++++++
2 files changed, 13 insertions(+)
diff --git a/erts/doc/src/erl.xml b/erts/doc/src/erl.xml
index bd03fb4970..bb81330fec 100644
--- a/erts/doc/src/erl.xml
+++ b/erts/doc/src/erl.xml
@@ -665,6 +665,8 @@
than 65536, the chosen value will increased to a value
larger or equal to the maximum amount of file descriptors that
can be opened.
+ On Windows the default value is set to 8196 because the
+ normal OS limitations are set higher than most machines can handle.
Previously the environment variable ERL_MAX_PORTS was used
for setting the maximum number of simultaneously existing ports. This
environment variable is deprecated, and scheduled for removal in
diff --git a/erts/emulator/beam/erl_port.h b/erts/emulator/beam/erl_port.h
index 4052f4dbe8..377aa72ed5 100644
--- a/erts/emulator/beam/erl_port.h
+++ b/erts/emulator/beam/erl_port.h
@@ -31,7 +31,18 @@ typedef struct ErtsProc2PortSigData_ ErtsProc2PortSigData;
#include "erl_thr_progress.h"
#include "erl_trace.h"
+#ifndef __WIN32__
#define ERTS_DEFAULT_MAX_PORTS (1 << 16)
+#else
+/*
+ * Do not default to as many max ports on Windows
+ * as there are no os limits to stop system
+ * from running amok. If allowed to go too high
+ * windows rarely recovers from the errors and
+ * other OS processes can be effected.
+ */
+#define ERTS_DEFAULT_MAX_PORTS (1 << 13)
+#endif /* __WIN32__ */
#define ERTS_MIN_PORTS 1024
extern int erts_port_synchronous_ops;
--
cgit v1.2.3
From c717fc6e0d660cb39f09dc079643991559168d40 Mon Sep 17 00:00:00 2001
From: Lukas Larsson
Date: Mon, 25 Feb 2013 17:12:10 +0100
Subject: Update to work with new default windows max ports
---
lib/kernel/test/gen_tcp_misc_SUITE.erl | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/kernel/test/gen_tcp_misc_SUITE.erl b/lib/kernel/test/gen_tcp_misc_SUITE.erl
index a72e76f813..6b672004ec 100644
--- a/lib/kernel/test/gen_tcp_misc_SUITE.erl
+++ b/lib/kernel/test/gen_tcp_misc_SUITE.erl
@@ -50,6 +50,14 @@
oct_acceptor/1,
otp_7731_server/1, zombie_server/2, do_iter_max_socks/2]).
+init_per_testcase(iter_max_socks, Config) when is_list(Config) ->
+ Dog = case os:type() of
+ {win32,_} ->
+ test_server:timetrap(test_server:minutes(30));
+ _Else ->
+ test_server:timetrap(test_server:seconds(240))
+ end,
+ [{watchdog, Dog}|Config];
init_per_testcase(_Func, Config) when is_list(Config) ->
Dog = test_server:timetrap(test_server:seconds(240)),
[{watchdog, Dog}|Config].
@@ -590,7 +598,7 @@ iter_max_socks(doc) ->
["Open as many sockets as possible. Do this several times and check ",
"that we get the same number of sockets every time."];
iter_max_socks(Config) when is_list(Config) ->
- N = 20,
+ N = case os:type() of {win32,_} -> 10; _ -> 20 end,
%% Run on a different node in order to limit the effect if this test fails.
Dir = filename:dirname(code:which(?MODULE)),
{ok,Node} = test_server:start_node(test_iter_max_socks,slave,
--
cgit v1.2.3