aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKenneth Lundin <[email protected]>2012-03-28 13:28:40 +0200
committerKenneth Lundin <[email protected]>2012-03-29 17:07:54 +0200
commitf2802b90d02f41079dd7db4e14dbe9b6fea91255 (patch)
treed02271d1aa9e13c7cc6d904ca37b6114d25893b9 /lib
parenta24997ac5526cb7cbb5f3248aaa4abd403bf406a (diff)
downloadotp-f2802b90d02f41079dd7db4e14dbe9b6fea91255.tar.gz
otp-f2802b90d02f41079dd7db4e14dbe9b6fea91255.tar.bz2
otp-f2802b90d02f41079dd7db4e14dbe9b6fea91255.zip
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
Diffstat (limited to 'lib')
-rw-r--r--lib/asn1/src/asn1_db.erl16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/asn1/src/asn1_db.erl b/lib/asn1/src/asn1_db.erl
index 0862ef6e02..843fc66c9c 100644
--- a/lib/asn1/src/asn1_db.erl
+++ b/lib/asn1/src/asn1_db.erl
@@ -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),