<div dir="ltr">hi nginx:<br> please give me some help or hint:<br> I encountered a problem while ssi delegaties back end memcached servers. (ssi dispatches each include to a location with memcache_pass , which takes use of upstream.)<br>
<br> <br>ssi file looks like:<br> <!--# include virtual="/key?db_1" --> <br> <!--# include virtual="/key?db_2" --><br> <!--# include virtual="/key?db_3" --><br>....<br>
<br>After request for the url point to the ssi file, there is half of the chances I cant get any response. Request is blocked for 60 seconds(the epoll time-out) ends with nothing. <br>Sometimes I got the right response. the more include directives there are, the more chances requests are blocked.<br>
<br> But if I add 'wait="yes"' attribute to each include, there will be no problem.<br><br>I straced nginx, found that nginx closes the incorrect FD.<br><br><font face="monospace"><span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 43 </font></span>epoll_wait(8,
{{EPOLLOUT, {u32=166951744, u64=13826368082478857024}}, {EPOLLOUT,
{u32=166951824, u64=13826368082478857104}}, {EPOLLOUT, {u32=166951664,
u64=13826368082478856944}}, {EPOLLOUT, {u32=166951584,
u64=13826368082478856864}}, {EPOLLOUT, {u32=166951504,
u64=13826368082478856784}}, {EPOLLOUT, {u32=166951424,
u64=13826368082478856704}}, {EPOLLOUT, {u32=166951344,
u64=13826368082478856624}}, {EPOLLOUT, {u32=166951264,
u64=13826368082478856544}}, {EPOLLOUT, {u32=166951184,
u64=13826368580695062800}}}, 512, 60000) = 9<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 44 </font></span>gettimeofday({1217429875, 344754}, NULL) = 0<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 45 </font></span>getsockopt(16, SOL_SOCKET, SO_ERROR, [0], [4]) = 0<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 46 </font></span><span style="background-color: rgb(140, 203, 234);"><font color="#000000">writev</font></span>(16, [{"get db_8\r\n", 10}], 1) = 10<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 47 </font></span>getsockopt(15, SOL_SOCKET, SO_ERROR, [0], [4]) = 0<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 48 </font></span><span style="background-color: rgb(140, 203, 234);"><font color="#000000">writev</font></span>(15, [{"get db_7\r\n", 10}], 1) = 10<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 49 </font></span>getsockopt(14, SOL_SOCKET, SO_ERROR, [0], [4]) = 0<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 50 </font></span><span style="background-color: rgb(140, 203, 234);"><font color="#000000">writev</font></span>(14, [{"get db_6\r\n", 10}], 1) = 10<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 51 </font></span>getsockopt(13, SOL_SOCKET, SO_ERROR, [0], [4]) = 0<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 52 </font></span><span style="background-color: rgb(140, 203, 234);"><font color="#000000">writev</font></span>(13, [{"get db_5\r\n", 10}], 1) = 10<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 53 </font></span>getsockopt(12, SOL_SOCKET, SO_ERROR, [0], [4]) = 0<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 54 </font></span><span style="background-color: rgb(140, 203, 234);"><font color="#000000">writev</font></span>(12, [{"get db_4\r\n", 10}], 1) = 10<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 55 </font></span>getsockopt(11, SOL_SOCKET, SO_ERROR, [0], [4]) = 0<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 56 </font></span><span style="background-color: rgb(140, 203, 234);"><font color="#000000">writev</font></span>(11, [{"get db_3\r\n", 10}], 1) = 10<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 57 </font></span>getsockopt(10, SOL_SOCKET, SO_ERROR, [0], [4]) = 0<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 58 </font></span><span style="background-color: rgb(140, 203, 234);"><font color="#000000">writev</font></span>(10, [{"get db_2\r\n", 10}], 1) = 10<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 59 </font></span>getsockopt(9, SOL_SOCKET, SO_ERROR, [0], [4]) = 0<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 60 </font></span><span style="background-color: rgb(140, 203, 234);"><font color="#000000">writev</font></span>(9, [{"get db_1\r\n", 10}], 1) = 10<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 61 </font></span><span style="background-color: rgb(164, 229, 126);"><font color="#000000">recv</font></span>(6, 0xbfe125db, 1, MSG_PEEK) = -1 EAGAIN (Resource temporarily unavailable)<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 62 </font></span><br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 63 </font></span>epoll_wait(8,
{{EPOLLIN|EPOLLOUT, {u32=166951344, u64=13826368082478856624}},
{EPOLLIN|EPOLLOUT, {u32=166951424, u64=13826368082478856704}},
{EPOLLIN|EPOLLOUT, {u32=166951504, u64=13826368082478856784}},
{EPOLLIN|EPOLLOUT, {u32=166951584, u64=13826368082478856864}},
{EPOLLIN|EPOLLOUT, {u32=166951664, u64=13826368082478856944}},
{EPOLLIN|EPOLLOUT, {u32=166951824, u64=13826368082478857104}},
{EPOLLIN|EPOLLOUT, {u32=166951744, u64=13826368082478857024}}}, 512,
59997) = 7<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 64 </font></span>gettimeofday({1217429875, 346743}, NULL) = 0<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 65 </font></span><span style="background-color: rgb(164, 229, 126);"><font color="#000000">recv</font></span>(10, "VALUE db_2 0 1\r\n2\r\nEND\r\n", 100, 0) = 24<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 66 </font></span>setsockopt(6, SOL_TCP, TCP_NODELAY, [1], 4) = 0<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 67 </font></span><span style="background-color: rgb(255, 219, 114);"><font color="#000000">close</font></span>(9) = 0<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 68 </font></span><span style="background-color: rgb(164, 229, 126);"><font color="#000000">recv</font></span>(11, "VALUE db_3 0 1\r\n3\r\nEND\r\n", 100, 0) = 24<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 69 </font></span><span style="background-color: rgb(140, 203, 234);"><font color="#000000">writev</font></span>(6,
[{"HTTP/1.1 200 OK\r\nServer: nginx/0"..., 165}, {"5\r\n", 3},
{"Var=[", 5}, {"\r\n", 2}, {"1\r\n", 3}, {",", 1}, {"\r\n", 2},
{"1\r\n", 3}, {"2", 1}, {"\r\n", 2}], 10) = 187<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 70 </font></span><span style="background-color: rgb(255, 219, 114);"><font color="#000000">close</font></span>(10) = 0<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 71 </font></span><span style="background-color: rgb(164, 229, 126);"><font color="#000000">recv</font></span>(12, "VALUE db_4 0 1\r\n4\r\nEND\r\n", 100, 0) = 24<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 72 </font></span><span style="background-color: rgb(140, 203, 234);"><font color="#000000">writev</font></span>(6, [{"1\r\n", 3}, {",", 1}, {"\r\n", 2}, {"1\r\n", 3}, {"3", 1}, {"\r\n", 2}], 6) = 12<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 73 </font></span><span style="background-color: rgb(255, 219, 114);"><font color="#000000">close</font></span>(11) = 0<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 74 </font></span><span style="background-color: rgb(164, 229, 126);"><font color="#000000">recv</font></span>(13, "VALUE db_5 0 1\r\n5\r\nEND\r\n", 100, 0) = 24<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 75 </font></span><span style="background-color: rgb(140, 203, 234);"><font color="#000000">writev</font></span>(6, [{"1\r\n", 3}, {",", 1}, {"\r\n", 2}, {"1\r\n", 3}, {"4", 1}, {"\r\n", 2}], 6) = 12<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 76 </font></span><span style="background-color: rgb(255, 219, 114);"><font color="#000000">close</font></span>(12) = 0<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 77 </font></span><span style="background-color: rgb(164, 229, 126);"><font color="#000000">recv</font></span>(14, "VALUE db_6 0 1\r\n6\r\nEND\r\n", 100, 0) = 24<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 78 </font></span><span style="background-color: rgb(140, 203, 234);"><font color="#000000">writev</font></span>(6, [{"1\r\n", 3}, {",", 1}, {"\r\n", 2}, {"1\r\n", 3}, {"5", 1}, {"\r\n", 2}], 6) = 12<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 79 </font></span><span style="background-color: rgb(255, 219, 114);"><font color="#000000">close</font></span>(13) = 0<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 80 </font></span><span style="background-color: rgb(164, 229, 126);"><font color="#000000">recv</font></span>(15, "VALUE db_7 0 1\r\n7\r\nEND\r\n", 100, 0) = 24<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 81 </font></span><span style="background-color: rgb(140, 203, 234);"><font color="#000000">writev</font></span>(6, [{"1\r\n", 3}, {",", 1}, {"\r\n", 2}, {"1\r\n", 3}, {"6", 1}, {"\r\n", 2}], 6) = 12<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 82 </font></span><span style="background-color: rgb(255, 219, 114);"><font color="#000000">close</font></span>(14) = 0<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 83 </font></span><span style="background-color: rgb(164, 229, 126);"><font color="#000000">recv</font></span>(16, "VALUE db_8 0 1\r\n8\r\nEND\r\n", 100, 0) = 24<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 84 </font></span><span style="background-color: rgb(140, 203, 234);"><font color="#000000">writev</font></span>(6, [{"1\r\n", 3}, {",", 1}, {"\r\n", 2}, {"1\r\n", 3}, {"7", 1}, {"\r\n", 2}], 6) = 12<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 85 </font></span><span style="background-color: rgb(255, 219, 114);"><font color="#000000">close</font></span>(15) = 0<br>
<span style="background-color: rgb(211, 211, 211);"><font color="#a52a2a"> 86 </font></span>epoll_wait(8, </font><br clear="all"><br><br>Anybody might had experienced such problem can help me? I'll be very appreciated.<br>
<br>Is it a known bug?<br>I am trying to solve this problem, looking for something help through source-codes.<br><br>-- <br>要了几天饱饭就不记得西北风啥味了<br>
</div>