Skip to content

Commit a8aaeee

Browse files
author
Erlang/OTP
committed
Merge branch 'kuba/inets/start_httpd_manager_first/OTP-19486/ERIERL-1190' into maint-27
* kuba/inets/start_httpd_manager_first/OTP-19486/ERIERL-1190: inets: fix httpd startup sequence + net_adm default
2 parents cfe280c + 421479c commit a8aaeee

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

lib/inets/src/http_server/httpd_instance_sup.erl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,22 +80,22 @@ init([ConfigFile, ConfigList, AcceptTimeout, Debug, Address, Port]) ->
8080
Profile = proplists:get_value(profile, ConfigList, ?DEFAULT_PROFILE),
8181
Flags = {one_for_one, 0, 1},
8282
Children = [httpd_connection_sup_spec(Address, Port, Profile),
83-
httpd_acceptor_sup_spec(Address, Port, Profile, ConfigList, AcceptTimeout,
84-
undefined),
8583
sup_spec(httpd_misc_sup, Address, Port, Profile),
8684
worker_spec(httpd_manager, Address, Port, Profile,
87-
ConfigFile, ConfigList,AcceptTimeout)],
85+
ConfigFile, ConfigList,AcceptTimeout),
86+
httpd_acceptor_sup_spec(Address, Port, Profile, ConfigList, AcceptTimeout,
87+
undefined)],
8888
{ok, {Flags, Children}};
8989
init([ConfigFile, ConfigList, AcceptTimeout, Debug, Address, Port, ListenInfo]) ->
9090
httpd_util:enable_debug(Debug),
9191
Profile = proplists:get_value(profile, ConfigList, ?DEFAULT_PROFILE),
9292
Flags = {one_for_one, 0, 1},
9393
Children = [httpd_connection_sup_spec(Address, Port, Profile),
94-
httpd_acceptor_sup_spec(Address, Port, Profile, ConfigList, AcceptTimeout,
95-
ListenInfo),
9694
sup_spec(httpd_misc_sup, Address, Port, Profile),
9795
worker_spec(httpd_manager, Address, Port, Profile, ListenInfo,
98-
ConfigFile, ConfigList, AcceptTimeout)],
96+
ConfigFile, ConfigList, AcceptTimeout),
97+
httpd_acceptor_sup_spec(Address, Port, Profile, ConfigList, AcceptTimeout,
98+
ListenInfo)],
9999
{ok, {Flags, Children}}.
100100

101101

lib/inets/src/http_server/httpd_request_handler.erl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,18 @@ init([Manager, ConfigDB, AcceptTimeout]) ->
9999
%% At this point the function httpd_request_handler:start/2 will return.
100100
proc_lib:init_ack({ok, self()}),
101101
{SocketType, Socket} = await_socket_ownership_transfer(AcceptTimeout),
102-
ServerName = erlang:iolist_to_binary(httpd_util:lookup(ConfigDB, server_name)),
102+
ServerName =
103+
case httpd_util:lookup(ConfigDB, server_name) of
104+
undefined ->
105+
%% ERIERL-1190 workaround - on some rare occassions
106+
%% server_name can't be read from ets table
107+
net_adm:localhost();
108+
EtsValue ->
109+
EtsValue
110+
end,
111+
ServerNameBin = erlang:iolist_to_binary(ServerName),
103112
Protocol = protocol(SocketType),
104-
proc_lib:set_label({Protocol, ServerName}),
113+
proc_lib:set_label({Protocol, ServerNameBin}),
105114

106115
Peername = http_transport:peername(SocketType, Socket),
107116
Sockname = http_transport:sockname(SocketType, Socket),

0 commit comments

Comments
 (0)