Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
replace 5 sec timeout (too short) with monitor in asn1_db requests
This bug was introduced as part of the parallelization of test suites and is notpart of any released version
  • Loading branch information
KennethL committed Mar 29, 2012
1 parent a24997a commit f2802b9
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/asn1/src/asn1_db.erl
Expand Up @@ -48,11 +48,19 @@ dbstop() -> Resp = req(stop), erase(?MODULE), Resp.

%% Internal functions
req(Request) ->
get(?MODULE) ! {self(), Request},
receive {?MODULE, Reply} -> Reply after 5000 -> exit(db_timeout) end.
DbPid = get(?MODULE),
Ref = erlang:monitor(process,DbPid),
get(?MODULE) ! {{Ref, self()}, Request},
receive
{{Ref,?MODULE}, Reply} ->
erlang:demonitor(Ref,[flush]),
Reply;
{'DOWN',Ref,_,_,Info} ->
exit({db_error,Info})
end.

reply(From, Response) ->
From ! {?MODULE, Response}.
reply({Ref,From}, Response) ->
From ! {{Ref,?MODULE}, Response}.

init(Parent, Includes) ->
MRef = erlang:monitor(process, Parent),
Expand Down

0 comments on commit f2802b9

Please sign in to comment.