aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/erl_init.c6
-rw-r--r--erts/emulator/beam/erl_port.h11
2 files changed, 17 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_init.c b/erts/emulator/beam/erl_init.c
index 83853dcd43..e7e4030900 100644
--- a/erts/emulator/beam/erl_init.c
+++ b/erts/emulator/beam/erl_init.c
@@ -935,6 +935,12 @@ erl_start(int argc, char **argv)
(erts_aint32_t) max_gen_gcs);
}
+ envbufsz = sizeof(envbuf);
+ if (erts_sys_getenv_raw("ERL_MAX_PORTS", envbuf, &envbufsz) == 0) {
+ port_tab_sz = atoi(envbuf);
+ port_tab_sz_ignore_files = 1;
+ }
+
#if (defined(__APPLE__) && defined(__MACH__)) || defined(__DARWIN__)
/*
* The default stack size on MacOS X is too small for pcre.
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;