|
User
Joined: 19 May 2008
Posts: 33
|
Hi,
I was running ab (apache bench) on the yaws reverse proxy module and
got a crash which leaves the whole server wedged. The crash report is
below.
My theory is that the problem is related to this section in yaws_revproxy :
P1 = proc_lib:spawn_link(?MODULE, ploop, [Cli2, Srv, GC,
SC, self()]),
?Debug("Client=~p, Srv=~p", [P1, self()]),
ploop(Srv, Cli2, GC, SC, P1);
I can see that it is the process spawned with proc_lib which is the
one hitting the crash. My assumption is that this process has been
spawned to handle further data coming from the client (e.g. for
keep-alive). Is that correct? Anyway, my theory is that it is a
race condition of sorts and that the server has already sent a
response which is handled by the inline ploop and the connection is
closed *before* the spawned ploop gets a chance to be scheduled in and
so when it tries to operate on the socket it gets errors.
I have attached a patch which catches the problem. I'm not claiming
that it is the ideal solution but I can confirm that it stops the
server getting wedged by the error case.
Colm
=CRASH REPORT==== 30-Oct-2009::15:14:56 ===
crasher:
initial call: yaws_revproxy:ploop/5
pid: <0.74.0>
registered_name: []
exception error: no match of right hand side value {error,einval}
in function yaws:setopts/3
in call from yaws:do_http_get_headers/2
in call from yaws:http_get_headers/2
in call from yaws_revproxy:ploop/3
ancestors: [<0.57.0>,<0.56.0>,yaws_server,yaws_sup,<0.45.0>]
messages: []
links: [<0.57.0>]
dictionary: [{sc,{sconf,8000,3,[],undefined,undefined,
"/home/tobbe/docroot",[],
{0,0,0,0},
"sej",16401,undefined,[],nolimit,[],yaws_outmod,
yaws_outmod,yaws_outmod,yaws,[],undefined,
[yaws,php,cgi,fcgi],
[],
[{"/",
{url,http,"172.16.62.84",undefined,"/",[]}}],
[],[],undefined,undefined,undefined,
[{"ys",yaws_ext_handler_yaws}]}},
{ssl,nossl},
{gc,{gconf,"/root/devel/yaws-1.85",false,204,".",
["/root/devel/yaws-1.85/examples/ebin"],
[],15000,400,1000000,8000,nolimit,10240,[],
10000000,30,
["/root/devel/yaws-1.85/examples/include"],
"/usr/bin/php-cgi","Yaws 1.85","default",false}}]
trap_exit: false
status: running
heap_size: 1597
stack_size: 24
reductions: 286
neighbours:
neighbour: [{pid,<0.57.0>},
{registered_name,[]},
{initial_call,
{yaws_server,acceptor0,['Argument__1','Argument__2']}},
{current_function,{yaws_server,acceptor0,2}},
{ancestors,[<0.56.0>,yaws_server,yaws_sup,<0.45.0>]},
{messages,[]},
{links,[<0.56.0>,<0.74.0>,#Port<0.749>]},
{dictionary,
[{gc,{gconf,"/root/devel/yaws-1.85",false,204,".",
["/root/devel/yaws-1.85/examples/ebin"],
[],15000,400,1000000,8000,nolimit,10240,[],
10000000,30,
["/root/devel/yaws-1.85/examples/include"],
"/usr/bin/php-cgi","Yaws 1.85","default",
false}}]},
{trap_exit,false},
{status,waiting},
{heap_size,1597},
{stack_size,8},
{reductions,2353}]
Post received from mailinglist |
|
|