为什么 gen_tcp:controlling_process() 会因 badarg 失败?
我的 ejabberd 的一个模块有问题。它是http_bind。 但是当我深入调试时我发现在接受套接字和生成之后 处理流程以及何时重新分配流程以接收新创建流程的数据 通过调用 gen_tcp:controlling_process() 失败并出现 badarg,为什么?
...
{ok, Socket} = get_tcp:accept(ListenSocket),
Opts = [{active, false}, ...],
% here function return result of proc_lib:spawn_link(handler, ...)
{ok, Pid} = ejabberd_http:start({gen_tcp, Socket}, Opts),
gen_tcp:controlling_process(Socket, Pid),
: {badarg, [
{erlang, port_connect, [#Port<0.140743856>, <0.5939.4350>]},
{inet, tcp_controlling_process, 2},
{ejabberd_socket,start,4},
{ejabberd_listener,accept,3},
{proc_lib,init_p,5}
]}
有什么帮助吗?
I have a problem with one module of ejabberd. It is http_bind.
But when I debug deeply I found that after accept socket and spawning
hadling process and when reasign process for recieve data for new created process
by calling gen_tcp:controlling_process() failed with badarg, WHY?
...
{ok, Socket} = get_tcp:accept(ListenSocket),
Opts = [{active, false}, ...],
% here function return result of proc_lib:spawn_link(handler, ...)
{ok, Pid} = ejabberd_http:start({gen_tcp, Socket}, Opts),
gen_tcp:controlling_process(Socket, Pid),
: {badarg, [
{erlang, port_connect, [#Port<0.140743856>, <0.5939.4350>]},
{inet, tcp_controlling_process, 2},
{ejabberd_socket,start,4},
{ejabberd_listener,accept,3},
{proc_lib,init_p,5}
]}
any help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最有可能的是,套接字或进程在调用controller_process 之前已崩溃。
http://www.erlang.org/doc/man/erlang。 html#port_connect-2
为什么他们会崩溃我不知道,你确定 ejabberd 进程正在正常运行吗?
Most probably the socket or the process has crashed before the call to controlling_process.
http://www.erlang.org/doc/man/erlang.html#port_connect-2
Why they would have crashed I don't know, have you made sure that the ejabberd process is running as it should?