[erlang-questions] Unexpected {#Ref<0.0.0.110>, {error, closed}} message on passive SSL socket in R15

Ingela Andin ingela.andin@REDACTED
Fri Aug 10 10:51:21 CEST 2012


Hi!

This is a known bug that has been fixed in the upcoming release of the
ssl application.

Regards Ingela Erlang/OTP team - Ericsson AB

2012/8/9, Ulf Leopold <ulf.leopold@REDACTED>:
> Hi!
>
> When using an SSL socket in passive mode I receive a
> {#Ref<0.0.0.110>,{error,closed}} message after the connection is closed. I
> only see this message in R15 but not in R14B04. The example below can be
> used to reproduce the problem. I this expected behavior?
>
> Thanks,
>
> Ulf
>
>
> -module(test1).
> -export([f/0]).
>
> f() ->
>   ssl:start(),
>
>   {ok, S} = ssl:connect("www.google.com", 443, [{active, false}], 10000),
>   ok = ssl:send(S, "GET / HTTP1.1\r\n\r\n"),
>   get_all(S),
>   ok = ssl:close(S),
>
>   receive
>     {_, {error,closed}} = X -> io:format("got a: ~p~n", [X])
>   after 1000
>         -> io:format("no extra message~n")
>   end.
>
> get_all(S) ->
>   {ok, D} = ssl:recv(S, 0),
>   get_all(S, [D]).
>
> get_all(S, Acc) ->
>   case ssl:recv(S, 0) of
>     {error, closed} -> lists:append(lists:reverse(Acc));
>     {ok, D}         -> get_all(S, [D | Acc])
>   end.
>
>
> Example run:
>
>    Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:8:8] [rq:8]
> [async-threads:0] [kernel-poll:false]
>
>    Eshell V5.8.5  (abort with ^G)
>    1> c(test1).
>    {ok,test1}
>    2> test1:f().
>    no extra message
>
>
>    Erlang R15B (erts-5.9) [source] [64-bit] [smp:8:8] [async-threads:0]
> [hipe] [kernel-poll:false]
>
>    Eshell V5.9  (abort with ^G)
>    1> c(test1).
>    {ok,test1}
>    2> test1:f().
>    got a: {#Ref<0.0.0.110>,{error,closed}}
>



More information about the erlang-questions mailing list