【发布时间】:2020-07-07 18:42:03
【问题描述】:
我有点不知所措。 YAWS 在 LXQt 19.04 中作为服务启动时可以正常工作。但我打算使用速率限制器;将其设置为arg_rewrite_mod。让一个 VM 运行 YAWS 和另一个我的应用程序,适当地设置代码路径,我相信会产生低于标准的性能,因为速率限制调用将使用基于 OS 的 IPC 而不是 Erlang IPC。因此应该有 OS IPC 开销而不是 EVM 开销,对吗?
我基本上只是想把所有东西都放在一个引擎盖下来消除它。这是一回事,可能有几种方法可以解决问题(即拆分我的项目并在需要的地方复制部分),但我喜欢在一个地方所有东西的“简单性”。
我收到一个错误,{badmatch, {error, enoent}},在之后的 shell 中:
code:add_patha("/usr/lib/yaws/ebin").
application:start(yaws).
它发生在yaws_server:setup_dirs/1 (Github) 的第 548 行
setup_dirs(GC) ->
Dir = yaws:id_dir(GC#gconf.id),
Ctl = yaws:ctl_file(GC#gconf.id),
ok = filelib:ensure_dir(Ctl),
case file:list_dir(Dir) of
{ok, LL} ->
lists:foreach(
fun(F) ->
file:delete(filename:join([Dir, F]))
end, LL -- ["CTL"]); %%% <---- LINE 548
{error, RSN} ->
error_logger:format("Failed to list ~p probably "
"due to permission errs: ~p",
[Dir, RSN]),
erlang:error(RSN)
end.
我创建了一个 UNIX 组 appname,由我自己和用户 yaws 组成。我已经使用sudo find / -group yaws -type d 找到了各种目录,并将组权限设置为与所有者相同,并将组从yaws 重新分配为appname....我相信因为我没有设置@ 987654332@ 是"default"。我希望我的日志 (/var/log/yaws/report.log) 能指出问题所在。它们是空的。
我基本上使用默认的/etc/yaws/yaws.conf 文件。服务器部分已被删除并放置在 /etc/yaws/conf.avail/ 中,符号链接在 /etc/yaws/conf.d/ 中。
更新:崩溃报告----
2020-03-27T08:30:04.131073-05:00 notice: Yaws: Using config file /etc/yaws/yaws.conf
2020-03-27T08:30:04.136142-05:00 error: use_old_ssl in yaws.conf is no longer supported - ignoring
2020-03-27T08:30:04.137441-05:00 notice: Yaws: Using global subconfig file /etc/yaws/conf.d/localhost.conf
2020-03-27T08:30:04.140979-05:00 error:
crasher:
initial call: yaws_server:init/1,
pid: <0.114.0>,
registered_name: [],
error: {{badmatch,{error,enoent}},
[{yaws_server,setup_dirs,1,[{file,"yaws_server.erl"},{line,548}]},
{yaws_server,init2,5,[{file,"yaws_server.erl"},{line,224}]},
{gen_server,init_it,2,[{file,"gen_server.erl"},{line,374}]},
{gen_server,init_it,6,[{file,"gen_server.erl"},{line,342}]},
{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]},
ancestors: [yaws_sup,<0.108.0>],
message_queue_len: 0,
messages: [],
links: [<0.109.0>,#Port<0.6>],
dictionary: [{gc,{gconf,"/usr/lib/yaws",false,612,"/var/log/yaws",
["/usr/local/lib/yaws-appmods/ebin","/usr/lib/yaws/examples/ebin"],
[],[],30000,nolimit,400,1000000,8000,nolimit,[],10240,[],0,30,
["/usr/local/lib/yaws-appmods/include","/usr/lib/yaws/examples/include"],
"/usr/bin/php-cgi","Yaws 2.0.6","default",false,[],8,undefined,
[inet],yaws_session_server,undefined,120000,3600000,disable}},
{start_time,{{2020,3,27},{8,30,4}}}],
trap_exit: true,
status: running,
heap_size: 1598,
stack_size: 27,
reductions: 32410;
neighbours:
2020-03-27T08:30:04.141195-05:00 error:
supervisor: {local,yaws_sup},
errorContext: start_error,
reason: {{badmatch,{error,enoent}},
[{yaws_server,setup_dirs,1,[{file,"yaws_server.erl"},{line,548}]},
{yaws_server,init2,5,[{file,"yaws_server.erl"},{line,224}]},
{gen_server,init_it,2,[{file,"gen_server.erl"},{line,374}]},
{gen_server,init_it,6,[{file,"gen_server.erl"},{line,342}]},
{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]},
offender: [{pid,undefined},
{id,yaws_server},
{mfargs,
{yaws_server,start_link,
[{env,false,false,false,false,false,false,"default",latin1}]}},
{restart_type,permanent},
{shutdown,120000},
{child_type,worker}]
2020-03-27T08:30:04.145621-05:00 error:
crasher:
initial call: application_master:init/4,
pid: <0.107.0>,
registered_name: [],
exit: {{{shutdown,{failed_to_start_child,yaws_server,{{badmatch,{error,enoent}},
[{yaws_server,setup_dirs,1,[{file,"yaws_server.erl"},{line,548}]},
{yaws_server,init2,5,[{file,"yaws_server.erl"},{line,224}]},
{gen_server,init_it,2,[{file,"gen_server.erl"},{line,374}]},
{gen_server,init_it,6,[{file,"gen_server.erl"},{line,342}]},
{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}}},
{yaws_app,start,[normal,[]]}},
[{application_master,init,4,[{file,"application_master.erl"},{line,138}]},
{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]},
ancestors: [<0.106.0>],
message_queue_len: 1,
messages: [{'EXIT',<0.108.0>,normal}],
links: [<0.106.0>,<0.43.0>],
dictionary: [],
trap_exit: true,
status: running,
heap_size: 987,
stack_size: 27,
reductions: 225;
neighbours:
2020-03-27T08:30:04.147171-05:00 notice:
application: yaws,
exited: {{shutdown,{failed_to_start_child,yaws_server,{{badmatch,{error,enoent}},
[{yaws_server,setup_dirs,1,[{file,"yaws_server.erl"},{line,548}]},
{yaws_server,init2,5,[{file,"yaws_server.erl"},{line,224}]},
{gen_server,init_it,2,[{file,"gen_server.erl"},{line,374}]},
{gen_server,init_it,6,[{file,"gen_server.erl"},{line,342}]},
{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},
{line,249}]}]}}},{yaws_app,start,[normal,[]]}},
type: temporary
解决方案:
从下面答案的帮助和使用上面的find 探索各种 YAWS 路径,我发现我的“默认”主目录是 `/var/cache/yaws/'。 shell 中的以下一系列命令对我有用:
os:putenv("YAWSHOME","/var/cache/yaws/").
code:add_patha("/usr/lib/yaws/ebin").
application:start(yaws).
【问题讨论】:
-
您能否从您的崩溃报告中显示更多详细信息?
-
很高兴……让我熟悉一下记录器。当我这样做时会更新。
-
太好了,感谢您添加的崩溃报告信息。另一个问题:你运行的是什么版本的 Yaws?
-
我正在运行 2.0.6。