forked from erlang/otp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow appup instruction delete_module module which is not loaded
The appup instruction 'delete_module' would cause a crash during upgrade if the module to be deleted was not loaded. The reason was that the release_handler tried to read the version number of the old module after the code path had changed to point to the new version of the application. Thus, if the module had not been loaded before the upgrade, there would no longer be any such module in the path (delete_module indicates that the module is deleted from the new version of the application). This is corrected by letting the release_handler read the old version of the module only if the module is updated - not if it is removed. And it is always read before the code path is changed.
- Loading branch information
1 parent
ce83479
commit d92cf25
Showing
11 changed files
with
205 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
lib/sasl/test/release_handler_SUITE_data/lib/b-1.0/ebin/b.app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
%% -*- erlang -*- | ||
{application, b, | ||
[{description, "B CXC 138 12"}, | ||
{vsn, "1.0"}, | ||
{modules, [{b_server, 1},{b_lib, 1}]}, | ||
{registered, [b_server]}, | ||
{applications, [kernel, stdlib]}]}. |
3 changes: 3 additions & 0 deletions
3
lib/sasl/test/release_handler_SUITE_data/lib/b-1.0/src/b_lib.erl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-module(b_lib). | ||
-compile(export_all). | ||
foo() -> ok. |
37 changes: 37 additions & 0 deletions
37
lib/sasl/test/release_handler_SUITE_data/lib/b-1.0/src/b_server.erl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
-module(b_server). | ||
|
||
-behaviour(gen_server). | ||
|
||
%% API | ||
-export([start_link/0]). | ||
|
||
%% gen_server callbacks | ||
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, | ||
terminate/2, code_change/3]). | ||
|
||
-define(SERVER, ?MODULE). | ||
|
||
-record(state, {}). | ||
|
||
start_link() -> | ||
gen_server:start_link({local, ?SERVER}, ?MODULE, [], []). | ||
|
||
init([]) -> | ||
{ok, #state{}}. | ||
|
||
handle_call(_Request, _From, State) -> | ||
Reply = ok, | ||
{reply, Reply, State}. | ||
|
||
handle_cast(_Msg, State) -> | ||
{noreply, State}. | ||
|
||
handle_info(_Info, State) -> | ||
{noreply, State}. | ||
|
||
terminate(_Reason, _State) -> | ||
ok. | ||
|
||
code_change(OldVsn, State, Extra) -> | ||
file:write_file("/tmp/b_server",io_lib:format("~p~n",[{"1.0",OldVsn,Extra}])), | ||
{ok, State}. |
7 changes: 7 additions & 0 deletions
7
lib/sasl/test/release_handler_SUITE_data/lib/b-2.0/ebin/b.app
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
%% -*- erlang -*- | ||
{application, b, | ||
[{description, "B CXC 138 12"}, | ||
{vsn, "2.0"}, | ||
{modules, [{b_server, 1}]}, | ||
{registered, [b_server]}, | ||
{applications, [kernel, stdlib]}]}. |
3 changes: 3 additions & 0 deletions
3
lib/sasl/test/release_handler_SUITE_data/lib/b-2.0/ebin/b.appup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{"2.0", | ||
[{"1.0",[{delete_module,b_lib}, {update,b_server,{advanced,[]}}]}], | ||
[{"1.0",[{add_module,b_lib},{update,b_server,{advanced,[]}}]}]}. |
3 changes: 3 additions & 0 deletions
3
lib/sasl/test/release_handler_SUITE_data/lib/b-2.0/src/b_lib.erl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
-module(b_lib). | ||
-compile(export_all). | ||
foo() -> ok. |
37 changes: 37 additions & 0 deletions
37
lib/sasl/test/release_handler_SUITE_data/lib/b-2.0/src/b_server.erl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
-module(b_server). | ||
|
||
-behaviour(gen_server). | ||
|
||
%% API | ||
-export([start_link/0]). | ||
|
||
%% gen_server callbacks | ||
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, | ||
terminate/2, code_change/3]). | ||
|
||
-define(SERVER, ?MODULE). | ||
|
||
-record(state, {}). | ||
|
||
start_link() -> | ||
gen_server:start_link({local, ?SERVER}, ?MODULE, [], []). | ||
|
||
init([]) -> | ||
{ok, #state{}}. | ||
|
||
handle_call(_Request, _From, State) -> | ||
Reply = ok, | ||
{reply, Reply, State}. | ||
|
||
handle_cast(_Msg, State) -> | ||
{noreply, State}. | ||
|
||
handle_info(_Info, State) -> | ||
{noreply, State}. | ||
|
||
terminate(_Reason, _State) -> | ||
ok. | ||
|
||
code_change(OldVsn, State, Extra) -> | ||
file:write_file("/tmp/b_server",io_lib:format("~p~n",[{"2.0",OldVsn,Extra}])), | ||
{ok, State}. |