[erlang-questions] Erlang OTP 18 memory leak / SSL

Sereysethy TOUCH <>
Mon Sep 21 10:11:44 CEST 2015


Hello,

It works. But Ingela suggested that I should set session_lifetime option to
ssl which by default limit to 24h.

I wonder where should I put this option?

% erlang.mk make file for application

{application, ws_user, [
{description, "Cowboy websocket for users."},
{vsn, "1"},
{modules, []},
{registered, [ws_user_sup]},
{applications, [
kernel,
stdlib,
cowboy,
ssl,
erlydtl,
xmerl
]},
{mod, {ws_user_app, []}},
{env, []}
]}.

Thanks, Sethy

On Mon, Sep 21, 2015 at 2:11 PM, Loïc Hoguin <> wrote:

> You need the dev library of OpenSSL when you compile Erlang, otherwise
> crypto, public_key and ssl won't be available.
>
> On 09/21/2015 09:04 AM, Sereysethy TOUCH wrote:
>
>> Hello,
>>
>> I use erlang.mk <http://erlang.mk> to build my application. After I
>> successfully built erlang from maint branch using kerl, when I compiled
>> my application, I got this error:
>>
>> My erlang is Erlang/OTP 18 [erts-7.0.3] [source-5991161] [64-bit]
>> [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
>>
>> Failed to solve release:
>>
>>   Dependency ssl is specified as a dependency but is not reachable by
>> the system.
>>
>>
>> Any ideas?
>>
>>
>> On Sun, Sep 20, 2015 at 11:18 PM, Loïc Hoguin <
>> <mailto:>> wrote:
>>
>>     As far as I understand, 18.1 will be released very soon, maybe this
>>     week, so perhaps your problems will be gone in a few days without
>>     having to do anything. :-)
>>
>>     On 09/20/2015 06:04 PM, Sereysethy TOUCH wrote:
>>
>>         FYI, I use erlang.mk <http://erlang.mk> <http://erlang.mk> to
>>         build my application.
>>
>>         On Sun, Sep 20, 2015 at 10:53 PM, Sereysethy TOUCH
>>         < <mailto:>
>>         <mailto:
>>         <mailto:>>> wrote:
>>
>>              Hello,
>>
>>              When do you think a new version erlang 18 will be released
>>         which
>>              fixes this problem?
>>
>>              So you suggest that I should build the maint branch? And
>>         what to do
>>              with erlang installed on my server?
>>
>>              I will stick with shell. No gui.
>>
>>              Sorry I seem confused. Need more helps here :-)
>>
>>
>>
>>              On Sunday, 20 September 2015, Jesper Louis Andersen
>>              <
>>         <mailto:>
>>              <mailto:
>>         <mailto:>>> wrote:
>>
>>                  Ingela suggested you try building the "maint" branch,
>>         which has
>>                  a fix for the session cache problem (by Ingela :)
>>
>>                  simply git pull https://github.com/erlang/otp
>>
>>                  checkout the maint branch
>>
>>                  build the result. Alterantively, the 'kerl' application
>>         (also on
>>                  github) can build Erlang. It has an experimental
>>         git-mode which
>>                  may be useful here.
>>
>>                  I think you are looking at the SSL session cache problem.
>>
>>                  As for observer: observer:start() will start it:
>>
>>                  * You need wx in your Erlang installation, it is a GUI
>>         application
>>                  * You need something which can run wx applications. It is
>>                  somewhat easy in a local dev environment, but the shell
>>         commands
>>                  can be useful in contexts with no easy GUI-line :)
>>
>>
>>
>>                  On Sun, Sep 20, 2015 at 3:30 PM, Sereysethy TOUCH
>>                  <
>>         <mailto:>> wrote:
>>
>>                      Dear Andin,
>>
>>                      To be honest, I am new to Erlang. So I am sorry
>>         sometimes
>>                      for my naive questions.
>>
>>                      I just tried to fix and debug erlang code written
>>         by another
>>                      person. I am not sure yet where to look at. Since
>>         we dont
>>                      use anything special about SSL, beside we ask user
>>         browser
>>                      to present certificate and pass it on to our agent
>>         backend
>>                      to process it. I look at the code, it seems nothing
>>         is unusual.
>>
>>                      You said this bug exists since Erlang 17? But why
>>         there were
>>                      no memory leak when it ran on Erlang 17.
>>
>>                      I did as Jesper Louis Andersen suggested, and I saw
>>         there a
>>                      big amount of memory being used by ssl_manager.
>>
>>                      32794           client_ssl_otp_session_cache
>>         ordered_set 0
>>                          89       ssl_manager
>>                      36891           server_ssl_otp_session_cache
>>         ordered_set
>>                      1564   67995    ssl_manager
>>                      40993           httpc_manager__session_cookie_db
>>         bag   0
>>                        299      httpc_manager
>>
>>                      And it keeps increasing overtime.
>>
>>                      Can you let me know or pointing me to any documents
>>         on how
>>                      to use observer application?
>>
>>                      Thanks, Sethy
>>
>>                      On Sun, Sep 20, 2015 at 5:07 AM, Ingela Andin
>>                      <
>>         <mailto:>> wrote:
>>
>>                          Hi!
>>
>>                          2015-09-19 18:34 GMT+02:00 Sereysethy TOUCH
>>                          <
>>         <mailto:>>:
>>
>>
>>                              Hello,
>>
>>                              I just recently updated Erlang to latest
>>         version OTP
>>                              18 on Ubuntu server. It uses cowboy
>>         (websocket),
>>                              ranch, ssl, erlydtl & rabbitmq. It used to
>>         work fine
>>                              in OTP 17. The program is correctly
>>         compiled but
>>                              during the execution the memory kept
>>         increasing. I
>>                              need to restart the process every one or
>>         two hours
>>                              to free some memory.
>>
>>                              I have read a post here
>>
>>         [
>> http://erlang.2086793.n4.nabble.com/R18-Unbounded-SSL-Session-ETS-Table-Growth-td4713697.html
>> ]
>>                              which discussed about the ssl_session_cache
>> ETS
>>                              table which can become very large.
>>
>>
>>                          Well that bug is now fixed for 18.1 and in maint
>> on
>>                          github. This bug however has been around for a
>>         while so
>>                          it is unlikly that this bug causes 18 to behave
>>                          different from 17.
>>
>>                              The process beam.smp can go up to more than
>> 5G
>>                              during a few hours of executions.
>>
>>                              I am not yet sure what is the root cause of
>>         this issue.
>>
>>                              Does anyone know how to fix this? Or where
>>         should I
>>                              look at?
>>
>>
>>
>>                          You could try using the observer application to
>>         inspect
>>                          the node, makes inspecting easy.
>>                          Let us know your findings.
>>
>>                          Regards Ingela Erlang/OTP team - Ericsson AB
>>
>>
>>                              Thanks, Sethy
>>
>>
>>  _______________________________________________
>>                              erlang-questions mailing list
>>          <mailto:>
>>         http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>>
>>
>>                      _______________________________________________
>>                      erlang-questions mailing list
>>          <mailto:>
>>         http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>>
>>
>>                  --
>>                  J.
>>
>>
>>
>>
>>         _______________________________________________
>>         erlang-questions mailing list
>>          <mailto:>
>>         http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
>>     --
>>     Loïc Hoguin
>>     http://ninenines.eu
>>     Author of The Erlanger Playbook,
>>     A book about software development using Erlang
>>
>>
>>
> --
> Loïc Hoguin
> http://ninenines.eu
> Author of The Erlanger Playbook,
> A book about software development using Erlang
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150921/5fb2a7fb/attachment.html>


More information about the erlang-questions mailing list