File 0669-ssl-Workaround-Solaris-and-OpenBSD-data-delivery-iss.patch of Package erlang
From 387544f9f8721a9031711a46a1ce5ed7a32959de Mon Sep 17 00:00:00 2001
From: Ingela Anderton Andin <ingela@erlang.org>
Date: Tue, 7 Jan 2020 14:54:38 +0100
Subject: [PATCH] ssl: Workaround Solaris and OpenBSD data delivery issue when
kernel buffers are small
---
lib/ssl/test/ssl_packet_SUITE.erl | 5 +++--
lib/ssl/test/ssl_payload_SUITE.erl | 30 ++++++++++++++++--------------
lib/ssl/test/ssl_test_lib.erl | 12 ++++++++++++
3 files changed, 31 insertions(+), 16 deletions(-)
diff --git a/lib/ssl/test/ssl_packet_SUITE.erl b/lib/ssl/test/ssl_packet_SUITE.erl
index b71be64787..e6b4108fb2 100644
--- a/lib/ssl/test/ssl_packet_SUITE.erl
+++ b/lib/ssl/test/ssl_packet_SUITE.erl
@@ -2009,7 +2009,8 @@ packet(Config, Data, Send, Recv, Quantity, Packet, Active) ->
Server = ssl_test_lib:start_server([{node, ClientNode}, {port, 0},
{from, self()},
{mfa, {?MODULE, Send ,[Data, Quantity]}},
- {options, [{packet, Packet}, {nodelay, true}| ServerOpts]}]),
+ {options, [{packet, Packet}, {nodelay, true}| ServerOpts]
+ ++ ssl_test_lib:bigger_buffers()}]),
Port = ssl_test_lib:inet_port(Server),
Client = ssl_test_lib:start_client([{node, ServerNode}, {port, Port},
{host, Hostname},
@@ -2018,7 +2019,7 @@ packet(Config, Data, Send, Recv, Quantity, Packet, Active) ->
{options, [{active, Active},
{nodelay, true},
{packet, Packet} |
- ClientOpts]}]),
+ ClientOpts] ++ ssl_test_lib:bigger_buffers()}]),
ssl_test_lib:check_result(Client, ok),
diff --git a/lib/ssl/test/ssl_payload_SUITE.erl b/lib/ssl/test/ssl_payload_SUITE.erl
index 91043408b7..f9241ee2a2 100644
--- a/lib/ssl/test/ssl_payload_SUITE.erl
+++ b/lib/ssl/test/ssl_payload_SUITE.erl
@@ -27,6 +27,7 @@
-define(TIMEOUT, 600000).
+
%%--------------------------------------------------------------------
%% Common Test interface functions -----------------------------------
%%--------------------------------------------------------------------
@@ -523,7 +524,7 @@ server_echos_passive(
[{node, ServerNode}, {port, 0},
{from, self()},
{mfa, {?MODULE, echoer, [Length]}},
- {options, [{active, false}, {mode, binary} | ServerOpts]}]),
+ {options, [{active, false}, {mode, binary} | ServerOpts] ++ ssl_test_lib:bigger_buffers()}]),
Port = ssl_test_lib:inet_port(Server),
Client =
ssl_test_lib:start_client(
@@ -531,7 +532,7 @@ server_echos_passive(
{host, Hostname},
{from, self()},
{mfa, {?MODULE, sender, [Data]}},
- {options, [{active, false}, {mode, binary} | ClientOpts]}]),
+ {options, [{active, false}, {mode, binary} | ClientOpts] ++ ssl_test_lib:bigger_buffers() }]),
%%
ssl_test_lib:check_result(Server, ok, Client, ok),
%%
@@ -569,7 +570,7 @@ server_echos_active_once(
[{node, ServerNode}, {port, 0},
{from, self()},
{mfa, {?MODULE, echoer_active_once, [Length]}},
- {options, [{active, once}, {mode, binary} | ServerOpts]}]),
+ {options, [{active, once}, {mode, binary} | ServerOpts] ++ ssl_test_lib:bigger_buffers()}]),
Port = ssl_test_lib:inet_port(Server),
Client =
ssl_test_lib:start_client(
@@ -577,7 +578,7 @@ server_echos_active_once(
{host, Hostname},
{from, self()},
{mfa, {?MODULE, sender_active_once, [Data]}},
- {options, [{active, once}, {mode, binary} | ClientOpts]}]),
+ {options, [{active, once}, {mode, binary} | ClientOpts] ++ ssl_test_lib:bigger_buffers() }]),
%%
ssl_test_lib:check_result(Server, ok, Client, ok),
%%
@@ -593,7 +594,7 @@ server_echos_active(
[{node, ServerNode}, {port, 0},
{from, self()},
{mfa, {?MODULE, echoer_active, [Length]}},
- {options, [{active, true}, {mode, binary} | ServerOpts]}]),
+ {options, [{active, true}, {mode, binary} | ServerOpts] ++ ssl_test_lib:bigger_buffers()}]),
Port = ssl_test_lib:inet_port(Server),
Client =
ssl_test_lib:start_client(
@@ -601,7 +602,7 @@ server_echos_active(
{host, Hostname},
{from, self()},
{mfa, {?MODULE, sender_active, [Data]}},
- {options, [{active, true}, {mode, binary} | ClientOpts]}]),
+ {options, [{active, true}, {mode, binary} | ClientOpts] ++ ssl_test_lib:bigger_buffers()}]),
%%
ssl_test_lib:check_result(Server, ok, Client, ok),
%%
@@ -616,7 +617,7 @@ client_echos_passive(
[{node, ServerNode}, {port, 0},
{from, self()},
{mfa, {?MODULE, sender, [Data]}},
- {options, [{active, false}, {mode, binary} | ServerOpts]}]),
+ {options, [{active, false}, {mode, binary} | ServerOpts] ++ ssl_test_lib:bigger_buffers()}]),
Port = ssl_test_lib:inet_port(Server),
Client =
ssl_test_lib:start_client(
@@ -624,7 +625,7 @@ client_echos_passive(
{host, Hostname},
{from, self()},
{mfa, {?MODULE, echoer, [Length]}},
- {options, [{active, false}, {mode, binary} | ClientOpts]}]),
+ {options, [{active, false}, {mode, binary} | ClientOpts] ++ ssl_test_lib:bigger_buffers()}]),
%%
ssl_test_lib:check_result(Server, ok, Client, ok),
%%
@@ -640,7 +641,7 @@ client_echos_passive_chunk(
[{node, ServerNode}, {port, 0},
{from, self()},
{mfa, {?MODULE, sender, [Data]}},
- {options, [{active, false}, {mode, binary} | ServerOpts]}]),
+ {options, [{active, false}, {mode, binary} | ServerOpts] ++ ssl_test_lib:bigger_buffers()}]),
Port = ssl_test_lib:inet_port(Server),
Client =
ssl_test_lib:start_client(
@@ -648,7 +649,7 @@ client_echos_passive_chunk(
{host, Hostname},
{from, self()},
{mfa, {?MODULE, echoer_chunk, [Length]}},
- {options, [{active, false}, {mode, binary} | ClientOpts]}]),
+ {options, [{active, false}, {mode, binary} | ClientOpts] ++ ssl_test_lib:bigger_buffers()}]),
%%
ssl_test_lib:check_result(Server, ok, Client, ok),
%%
@@ -664,7 +665,7 @@ client_echos_active_once(
[{node, ServerNode}, {port, 0},
{from, self()},
{mfa, {?MODULE, sender_active_once, [Data]}},
- {options, [{active, once}, {mode, binary} | ServerOpts]}]),
+ {options, [{active, once}, {mode, binary} | ServerOpts] ++ ssl_test_lib:bigger_buffers()}]),
Port = ssl_test_lib:inet_port(Server),
Client =
ssl_test_lib:start_client(
@@ -672,7 +673,7 @@ client_echos_active_once(
{host, Hostname},
{from, self()},
{mfa, {?MODULE, echoer_active_once, [Length]}},
- {options,[{active, once}, {mode, binary} | ClientOpts]}]),
+ {options,[{active, once}, {mode, binary} | ClientOpts] ++ ssl_test_lib:bigger_buffers()}]),
%%
ssl_test_lib:check_result(Server, ok, Client, ok),
%%
@@ -687,7 +688,7 @@ client_echos_active(
[{node, ServerNode}, {port, 0},
{from, self()},
{mfa, {?MODULE, sender_active, [Data]}},
- {options, [{active, true}, {mode, binary} | ServerOpts]}]),
+ {options, [{active, true}, {mode, binary} | ServerOpts] ++ ssl_test_lib:bigger_buffers()}]),
Port = ssl_test_lib:inet_port(Server),
Client =
ssl_test_lib:start_client(
@@ -695,7 +696,7 @@ client_echos_active(
{host, Hostname},
{from, self()},
{mfa, {?MODULE, echoer_active, [Length]}},
- {options, [{active, true}, {mode, binary} | ClientOpts]}]),
+ {options, [{active, true}, {mode, binary} | ClientOpts] ++ ssl_test_lib:bigger_buffers()}]),
%
ssl_test_lib:check_result(Server, ok, Client, ok),
%%
@@ -811,3 +812,4 @@ echo_active(Socket, Size) ->
echo_active(Socket, Size - byte_size(Data))
end.
+
diff --git a/lib/ssl/test/ssl_test_lib.erl b/lib/ssl/test/ssl_test_lib.erl
index 6218857e05..8f16e66c89 100644
--- a/lib/ssl/test/ssl_test_lib.erl
+++ b/lib/ssl/test/ssl_test_lib.erl
@@ -2387,3 +2387,15 @@ openssl_sane_dtls_session_reuse() ->
{win32, _} ->
os:cmd("cmd.exe /C \"taskkill /IM openssl.exe /F\"")
end.
+
+-define(BIG_BUF, 10000000).
+%% Workaround data delivery issues on solaris | openbsd when kernel buffers are small
+bigger_buffers() ->
+ case os:type() of
+ {unix,sunos} ->
+ [{recbuf, ?BIG_BUF},{sndbuf, ?BIG_BUF}];
+ {unix,openbsd} ->
+ [{recbuf, ?BIG_BUF},{sndbuf, ?BIG_BUF}];
+ _ ->
+ []
+ end.
--
2.16.4