Can't call ssl:transport_accept/ssl:accept from multiple processes

Kaiduan Xie <>
Fri Feb 4 04:03:18 CET 2011


Hi, all,

I am having trouble to accept SSL connection from multiple processes,
two processes are spawned on server side with the following code,

tls_acceptor(LSock) ->
    {ok, Socket} = ssl:transport_accept(LSock),
    ok = ssl:ssl_accept(Socket),
    {ok, {PeerAddr, PeerPort}} = ssl:peername(Socket),
    PA = erlsip_util:tuple_ip4_to_str_ip4(PeerAddr),
    ?DEBUG("Accept from: ~p:~p", [self(), PA]),
    tls_acceptor(LSock).

And the log shows that server alternatively accepts from two processes
and the it stops accepting more,

=INFO REPORT==== 03-02-2011::21:35:49:378 ===
DEBUG|<0.119.0>|erlsip_transport_tls|117| Accept from: <0.119.0>:"192.168.1.3"

=INFO REPORT==== 03-02-2011::21:35:49:418 ===
DEBUG|<0.120.0>|erlsip_transport_tls|117| Accept from: <0.120.0>:"192.168.1.3"

=INFO REPORT==== 03-02-2011::21:35:49:418 ===
DEBUG|<0.119.0>|erlsip_transport_tls|117| Accept from: <0.119.0>:"192.168.1.3"

=INFO REPORT==== 03-02-2011::21:35:49:419 ===
DEBUG|<0.120.0>|erlsip_transport_tls|117| Accept from: <0.120.0>:"192.168.1.3"

=INFO REPORT==== 03-02-2011::21:35:49:457 ===
DEBUG|<0.119.0>|erlsip_transport_tls|117| Accept from: <0.119.0>:"192.168.1.3"

The wireshark trace attached shows that server does not send out
"Server Hello" for the sixth connection.

If one process is spawned instead of one, the problem is gone.

I would like to scale up the SSL connection establishment speed on
multi-core box. For sake of completeness, I have tried on R14B and
R14B01 with same result.

Thanks for help,

/Kaiduan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ssl-accept.pcap
Type: application/cap
Size: 24243 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110203/10b00ebb/attachment.bin>


More information about the erlang-questions mailing list