processone / fast_tls

TLS / SSL OpenSSL-based native driver for Erlang / Elixir
https://www.ejabberd.im
Other
83 stars 37 forks source link

too many read_file_info fast_tls_drv.so #19

Closed lexus300h closed 7 years ago

lexus300h commented 7 years ago

when my server has 80, 000 TCP connections, the length of file_server_2's message_queue is grow quickly. When I check the process info ,I find this:

(ejabberd@xxxx)1> erlang:process_info(list_to_pid("<0.24.0>")). [{registered_name,file_server_2}, {current_function,{prim_file,drv_get_response,1}}, {initial_call,{proc_lib,init_p,5}}, {status,running}, {message_queue_len,37}, {messages,[{'$gen_call',{<0.29936.3282>,

Ref<0.0.11499.147076>},

                     {read_file_info,"/home/q/erlang1705/lib/erlang/lib/webtool-0.8.10/ebin/priv/lib/fast_tls_drv.so"}},
        {'$gen_call',{<0.11832.3264>,#Ref<0.0.11499.147077>},
                     {read_file_info,"/home/q/erlang1705/lib/erlang/lib/odbc-2.10.22/ebin/priv/lib/fast_tls_drv.so"}},
        {'$gen_call',{<0.21203.3289>,#Ref<0.0.11499.147078>},
                     {read_file_info,"/home/q/erlang1705/lib/erlang/lib/observer-2.0.4/ebin/priv/lib/fast_tls_drv.so"}},
        {'$gen_call',{<0.2585.3265>,#Ref<0.0.11499.147079>},
                     {read_file_info,"/home/q/erlang1705/lib/erlang/lib/mnesia-4.12.5/ebin/priv/lib/fast_tls_drv.so"}},
        {'$gen_call',{<0.28603.3278>,#Ref<0.0.11499.147080>},
                     {read_file_info,"/home/q/erlang1705/lib/erlang/lib/inets-5.10.6/ebin/priv/lib/fast_tls_drv.so"}},
        {'$gen_call',{<0.30249.3174>,#Ref<0.0.11499.147081>},
                     {read_file_info,"/home/q/erlang1705/lib/erlang/lib/erl_docgen-0.3.7/ebin/priv/lib/fast_tls_drv.so"}},
        {'$gen_call',{<0.15376.3271>,#Ref<0.0.11499.147085>},
                     {read_file_info,"/home/q/erlang1705/lib/erlang/lib/erl_interface-3.7.20/ebin/priv/lib/fast_tls_drv.so"}},
        {'$gen_call',{<0.23830.3243>,#Ref<0.0.11499.147086>},
                     {read_file_info,"/home/q/erlang1705/lib/erlang/lib/xmerl-1.3.7/ebin/priv/lib/fast_tls_drv.so"}},
        {'$gen_call',{<0.28361.3231>,#Ref<0.0.11499.147087>},
                     {read_file_info,"/home/q/erlang1705/lib/erlang/lib/debugger-4.0.3/ebin/priv/lib/fast_tls_drv.so"}},
        {'$gen_call',{<0.21951.3224>,#Ref<0.0.11499.147088>},
                     {read_file_info,"/home/q/erlang1705/lib/erlang/lib/et-1.5/ebin/priv/lib/fast_tls_drv.so"}},
        {'$gen_call',{<0.24450.3247>,#Ref<0.0.11499.147090>},
                     {read_file_info,"/home/q/erlang1705/lib/erlang/lib/crypto-3.5/ebin/priv/lib/fast_tls_drv.so"}},
        {'$gen_call',{<0.2854.3273>,#Ref<0.0.11499.147092>},
                     {read_file_info,"/home/q/erlang1705/lib/erlang/lib/odbc-2.10.22/ebin/priv/lib/fast_tls_drv.so"}},
        {'$gen_call',{<0.6034.3189>,#Ref<0.0.11499.147095>},
                     {read_file_info,"/home/q/erlang1705/lib/erlang/lib/ic-4.3.6/ebin/priv/lib/fast_tls_drv.so"}},
        {'$gen_call',{<0.4923.3252>,#Ref<0.0.11499.147096>},
                     {read_file_info,"/home/q/erlang1705/lib/erlang/lib/compiler-5.0.4/ebin/priv/lib/fast_tls_drv.so"}},
        {'$gen_call',{<0.14453.3275>,#Ref<0.0.11499.147100>},
                     {read_file_info,"/home/q/erlang1705/lib/erlang/lib/megaco-3.17.3/ebin/priv/lib/fast_tls_drv.so"}},
        {'$gen_call',{<0.21126.3243>,#Ref<0.0.11499.147111>},
                     {read_file_info,[...]}},
        {'$gen_call',{<0.28121.3229>,#Ref<0.0.11499.147118>},
                     {read_file_info,...}},
        {'$gen_call',{<0.26819.3263>,...},{...}},
        {'$gen_call',{...},...},
        {'$gen_call',...},
        {...}|...]},

{links,[#Port<0.112>,<0.11.0>]}, {dictionary,[{'$ancestors',[kernel_sup,<0.10.0>]}, {'$initial_call',{file_server,init,1}}]}, {trap_exit,true}, {error_handler,error_handler}, {priority,normal}, {group_leader,<0.9.0>}, {total_heap_size,225340}, {heap_size,28690}, {stack_size,30}, {reductions,249704733833}, {garbage_collection,[{min_bin_vheap_size,46422}, {min_heap_size,233}, {fullsweep_after,65535}, {minor_gcs,45393}]}, {suspending,[]}]

I can't understand why so many gen_call to get the file info of fast_tls_drv.so

prefiks commented 7 years ago

This doesn't look like something related to fast_tls to me, this process from which this queue comes is responsible for loading erlang beam files. Do you really have all those fast_tls_drv.so in all those dirs? Maybe you have some recursive symlink here?

lexus300h commented 7 years ago

I used ejabberd1407, and opened the tls. I can't find the place of those gen calls. Can you give me some tips, Thanks.

prefiks commented 7 years ago

I am guessing this is from erlang system code that tires to load/locate fast_tls_drv.so file. Do you really have all those files in: /home/q/erlang1705/lib/erlang/lib/megaco-3.17.3/ebin/priv/lib/fast_tls_drv.so /home/q/erlang1705/lib/erlang/lib/compiler-5.0.4/ebin/priv/lib/fast_tls_drv.so

or it just iterates over all your library paths?

prefiks commented 7 years ago

Could you look at your ejabberd installation and see where you have fast_tls_drv.so?

lexus300h commented 7 years ago

the path is /home/q/ejabberd1407/lib/ejabberd/priv/lib/fast_tls_drv.so. I just make and make install to install the ejabberd, doesn't change anything.

$ pwd /home/q/ejabberd1407 $ sudo find . -name fast_tls_drv.so ./lib/ejabberd/priv/lib/fast_tls_drv.so

prefiks commented 7 years ago

Ok i am pretty sure ejabberd 14.07 don't use fast_tls_drv.so (when it was released it used p1_tls_drv), so i am not sure what tries to load it.

In never version of ejabberd files are installed differently, fast_tls_drv.so will be installed in ./lib/fast_tls-1.0.X/priv/lib/fast_tls_drv.so and this is where code that load this file looks first, but if it can't find it checks all registered library paths for that file, which i guess what happens here.

Updating to newer ejabberd, or trying to see why it tries to use fast_tls insteas od p1_tls will be a solution here.

lexus300h commented 7 years ago

thanks, it's me to update the tls deps. I try to update my ejabberd. Thanks.

prefiks commented 7 years ago

For posterity, i added 0a8de230973278b8a2b1eea362a5d6b9ca328b58 that may help in cases where full search will be needed.

lexus300h commented 7 years ago

Got it. Thanks for your help.