[erlang-questions] erl_ddll bugfixes

Bjorn Gustavsson <>
Thu Oct 19 08:53:07 CEST 2006


Thanks for the bug report.

We read all emails but we are often slow to answer them.

In this case, we are in the progress of totally rewriting
the erl_ddll code for the R11B-2 release. The bugs you
mentioned will be corrected, as well as other issues.

/Bjorn

Jean-Sébastien Pédron <> writes:

> * PGP Signed by an unknown key: 10/18/2006 at 05:33:41 PM
> 
> Hello,
> 
> Note: I posted a mail a week ago on erlang-patches@ about a bug in
> erl_ddll but didn't get any feedback so I try again here.
> 
> erl_ddll contains a bug with reference count. You'll find an example of
> it in my first mail:
> http://www.erlang.org/pipermail/erlang-patches/2006-October/000164.html
> 
> To sum up quickly the problem, ddll_server will only keep a reference
> for the first and the last processes who loaded a library. Every
> in-between process references will be dropped with each call to
> erl_ddll:load_driver/2.
> 
> The consequence is that if the first and the last processes unload the
> driver, the library will be effectively unloaded and every still running
> port drivers will become unusable.
> 
> Since then, I found another bug regarding the link established between
> ddll_server and the process who called erl_ddll:load_driver/2. This link
> exists only between ddll_server and the first process. Following
> processes who load the same library won't have a link and if they exit
> without calling erl_ddll:unload_driver/1, their reference in ddll_server
> will remain there until ddll_server terminates.
> 
> These two bugs exist at least from R10B-7 up to R11B-1.
> 
> --
> Jean-Sébastien Pédron
> Meetic Corp.
> 
> * Unknown Key
> * 0xC1583A53 (L)
> 
> --- otp_src_R11B-1-orig/lib/kernel/src/erl_ddll.erl	2006-05-03 09:59:12.000000000 +0200
> +++ otp_src_R11B-1/lib/kernel/src/erl_ddll.erl	2006-10-10 15:08:58.000000000 +0200
> @@ -164,8 +164,8 @@
>  
>  increment_process_count([{From, Count}|Rest], From, Result) ->
>      Result ++ [{From, Count+1}|Rest];
> -increment_process_count([Process|Rest], From, _Result) ->
> -    increment_process_count(Rest, From, [Process|Rest]);
> +increment_process_count([Process|Rest], From, Result) ->
> +    increment_process_count(Rest, From, [Process|Result]);
>  increment_process_count([], From, Result) ->
>      [{From, 1}|Result].
>  
> --- otp_src_R11B-1-orig/lib/kernel/src/erl_ddll.erl	2006-10-11 15:07:22.000000000 +0200
> +++ otp_src_R11B-1/lib/kernel/src/erl_ddll.erl	2006-10-11 15:05:33.000000000 +0200
> @@ -167,6 +167,7 @@
>  increment_process_count([Process|Rest], From, _Result) ->
>      increment_process_count(Rest, From, [Process|Rest]);
>  increment_process_count([], From, Result) ->
> +    link(From),
>      [{From, 1}|Result].
>  
>  %% Decrements the reference count for Driver in process From,
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions

-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB




More information about the erlang-questions mailing list