[erlang-questions] Can't call ssl:transport_accept/ssl:accept from multiple processes

Ingela Andin ingela@REDACTED
Fri Feb 4 09:37:35 CET 2011


Hi !

It sounds like it might be a socket ownership problem.
The best would be to have the socket in active false mode
and  then transfering socket ownership (ssl:controlling_process/2) to
the new process
before it gets to do ssl_accept.

Regards Ingela Erlang/OTP  team - Ericsson AB


2011/2/4 Kaiduan Xie <kaiduanx@REDACTED>:
> 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
>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>


More information about the erlang-questions mailing list