Просмотр исходного кода

fix supervisor spec for non dynamic modules

a release upgrade on a vm running cowboy where any other appup
includes an {update, Mod, {advanced, Extra}} instruction will hang
forever due to these child specs being wrong.

The gen_servers should be [Mod] and the non gen_server needs to be []
since there is no callback to handle this.
Steven Gravell 13 лет назад
Родитель
Сommit
1af77d45e3
3 измененных файлов с 3 добавлено и 3 удалено
  1. 1 1
      src/cowboy_acceptors_sup.erl
  2. 1 1
      src/cowboy_listener_sup.erl
  3. 1 1
      src/cowboy_sup.erl

+ 1 - 1
src/cowboy_acceptors_sup.erl

@@ -38,6 +38,6 @@ init([NbAcceptors, Transport, TransOpts,
 	Procs = [{{acceptor, self(), N}, {cowboy_acceptor, start_link, [
 	Procs = [{{acceptor, self(), N}, {cowboy_acceptor, start_link, [
 				LSocket, Transport, Protocol, ProtoOpts,
 				LSocket, Transport, Protocol, ProtoOpts,
 				MaxConns, ListenerPid, ReqsPid
 				MaxConns, ListenerPid, ReqsPid
-			]}, permanent, brutal_kill, worker, dynamic}
+      ]}, permanent, brutal_kill, worker, []}
 		|| N <- lists:seq(1, NbAcceptors)],
 		|| N <- lists:seq(1, NbAcceptors)],
 	{ok, {{one_for_one, 10, 10}, Procs}}.
 	{ok, {{one_for_one, 10, 10}, Procs}}.

+ 1 - 1
src/cowboy_listener_sup.erl

@@ -27,7 +27,7 @@ start_link(NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts) ->
 	{ok, SupPid} = supervisor:start_link(?MODULE, []),
 	{ok, SupPid} = supervisor:start_link(?MODULE, []),
 	{ok, ListenerPid} = supervisor:start_child(SupPid,
 	{ok, ListenerPid} = supervisor:start_child(SupPid,
 		{cowboy_listener, {cowboy_listener, start_link, []},
 		{cowboy_listener, {cowboy_listener, start_link, []},
-		 permanent, 5000, worker, dynamic}),
+		 permanent, 5000, worker, [cowboy_listener]}),
 	{ok, ReqsPid} = supervisor:start_child(SupPid,
 	{ok, ReqsPid} = supervisor:start_child(SupPid,
 		{cowboy_requests_sup, {cowboy_requests_sup, start_link, []},
 		{cowboy_requests_sup, {cowboy_requests_sup, start_link, []},
 		 permanent, 5000, supervisor, [cowboy_requests_sup]}),
 		 permanent, 5000, supervisor, [cowboy_requests_sup]}),

+ 1 - 1
src/cowboy_sup.erl

@@ -32,5 +32,5 @@ start_link() ->
 -spec init([]) -> {ok, {{one_for_one, 10, 10}, [{_, _, _, _, _, _}, ...]}}.
 -spec init([]) -> {ok, {{one_for_one, 10, 10}, [{_, _, _, _, _, _}, ...]}}.
 init([]) ->
 init([]) ->
 	Procs = [{cowboy_clock, {cowboy_clock, start_link, []},
 	Procs = [{cowboy_clock, {cowboy_clock, start_link, []},
-		permanent, 5000, worker, dynamic}],
+		permanent, 5000, worker, [cowboy_clock]}],
 	{ok, {{one_for_one, 10, 10}, Procs}}.
 	{ok, {{one_for_one, 10, 10}, Procs}}.