%% Start all the modules in all the hosts start_modules() -> lists:foreach( fun(Host) -> case ejabberd_config:get_local_option({modules, Host}) of undefined -> ok; Modules -> lists:foreach( fun({Module, Args}) -> gen_mod:start_module(Host, Module, Args) end, Modules) end end, ?MYHOSTS).
get_ejabberd_config_path() -> case application:get_env(config) of {ok, Path} -> Path; undefined -> case os:getenv("EJABBERD_CONFIG_PATH") of false -> ?CONFIG_PATH; Path -> Path end end.
split_terms_macros(Terms) -> lists:foldl( fun(Term, {TOs, Ms}) -> case Term of {define_macro, Key, Value} -> case is_atom(Key) and is_all_uppercase(Key) of true -> {TOs, Ms++[{Key, Value}]}; false -> exit({macro_not_properly_defined, Term}) end; Term -> {TOs ++ [Term], Ms} end end, {[], []}, Terms).
{max_fsm_queue, N} -> add_option(max_fsm_queue, N, State);
以选项名和Host一起做为key进行存储,如domain_certfile选项:
1 2 3 4 5 6 7 8
{domain_certfile, Domain, CertFile} -> case ejabberd_config:is_file_readable(CertFile) of true -> add_option({domain_certfile, Domain}, CertFile, State); false -> ErrorText = "There is a problem in the configuration: " "the specified file is not readable: ", throw({error, ErrorText ++ CertFile}) end;
----------------------------------- # ODB is a binary format. There are no new lines or spaces in the file. 4f 50 45 4e 54 52 41 43 4b 45 52 # Magic String "OPENTRACKER" 30 30 30 33 # ODB Version Number in ASCII characters. In this case, version = "0001" = 1 ----------------------------------- FE # FE = Opcode that indicates following is a torrent information. ----------------------------------- # Torrent information starts from here. 00 02 2e 33 01 c4 a1 df bb 82 1f 51 0f b5 b6 02 6f 93 6e 9f # 20 byte info_hash of torrent ----------------------------------- e2 37 59 01 00 00 00 00 # Last access time in minutes since UNIX epoch, 8 bytes. # At present, when loading ODB file, just use current clock, ignore this. ----------------------------------- 00 00 00 00 00 00 00 00 # Seeding peer count for current torrent. 8 bytes long integer in little endian. # NOT used at present. ----------------------------------- 00 00 00 00 00 00 00 00 # Total peer count for current torrent. 8 bytes long integer in little endian. # NOT used at present. ----------------------------------- 00 00 00 00 00 00 00 00 # Download times of files in current torrent. 8 bytes long integer in little endian. # NOT used at present. ----------------------------------- 01 00 00 00 # Peer count in current peer, 4 bytes integer in little endian. ----------------------------------- # Peers information starts from here. 7f 00 00 01 # 4 bytes ip address in network byte order. In this case, 0x7f000001 = "127.0.0.1" 1b 31 # 2 bytes port in network byte order. In this case, 0x1b31 = 6961. 80 # Flag of peers. SEEDING = 0x80, COMPLETED = 0x40, STOPPED = 0x20, LEECHING = 0x00 00 # Reserved. Just set zero. ----------------------------------- ... # Other peers information. ----------------------------------- FE ----------------------------------- ... # Other torrent information. ----------------------------------- FF # EOF opcode.
[ pid=3413 thr=140583025772288 file=ext/nginx/HelperAgent.cpp:963 time=2014-09-30 11:05:20.925 ]: Uncaught exception in PassengerServer client thread: exception: Cannot accept new connection: Too many open files (24) backtrace: in 'Passenger::FileDescriptor Client::acceptConnection()' (HelperAgent.cpp:429) in 'void Client::threadMain()' (HelperAgent.cpp:952)
intexpand_files(struct files_struct *files, int nr) { structfdtable *fdt;
fdt = files_fdtable(files);
/* * N.B. For clone tasks sharing a files structure, this test * will limit the total number of files that can be opened. */ if (nr >= current->signal->rlim[RLIMIT_NOFILE].rlim_cur) return -EMFILE;
/* Do we need to expand? */ if (nr < fdt->max_fds) return0;
/* Can we expand? */ if (nr >= sysctl_nr_open) return -EMFILE;
/* All good, so we try */ return expand_fdtable(files, nr); }
可以看到expand_files进行文件描述符限制的检查,当超过限制时返回”EMFILE”。”EMFILE”错误的提示就是”Too many open files”。
structngx_http_variable_s { ngx_str_t name; /* must be first to build the hash */ ngx_http_set_variable_pt set_handler; ngx_http_get_variable_pt get_handler; uintptr_t data; ngx_uint_t flags; ngx_uint_t index; };