Deadlock bug in ssl library

mbj@REDACTED mbj@REDACTED
Fri Aug 26 16:15:52 CEST 2005


Here's a small program to reproduce the problem


-module(s).
-compile(export_all).

%% illustrates ssl deadlock problem

%% do  s:d() in an erlang shell
%% in a terminal shell, do 
%%     openssl s_client -connect localhost:5432 < a-1-MB-file


d() ->
    application:start(ssl),
    {ok, L} =
	ssl:listen(5432,
		   [{active, false},
		    {certfile, "/home/share/mbj/src/yaws/ssl/cert.example"},
		    {keyfile, "/home/share/mbj/src/yaws/ssl/key.example"}]),
    {ok, S} = ssl:accept(L),
    {ok, Data} = ssl:recv(S, 0),
    io:format("got ~p bytes\n", [length(Data)]),
    timer:sleep(10000),
    {ok, PeerName} = ssl:peername(S),
    io:format("peername: ~p\n", [PeerName]),
    ssl:close(S),
    ssl:close(L).



More information about the erlang-questions mailing list