<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:ËÎÌå;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"\@ËÎÌå";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        text-align:justify;
        text-justify:inter-ideograph;
        font-size:10.5pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
 /* Page Definitions */
 @page Section1
        {size:595.3pt 841.9pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;
        layout-grid:15.6pt;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=ZH-CN link=blue vlink=purple style='text-justify-trim:punctuation'>

<div class=Section1 style='layout-grid:15.6pt'>

<p class=MsoNormal><font size=1 face=Arial><span lang=EN-US style='font-size:
9.0pt;font-family:Arial'>Hello all!<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face=Arial><span lang=EN-US style='font-size:
9.0pt;font-family:Arial'>   Recently I came across a problem that CPU
100% when nginx upstream were trying to SSL handshake to the web sever.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face=Arial><span lang=EN-US style='font-size:
9.0pt;font-family:Arial'>   the pass_proxy url is
https://www.salesforce.com/export/login-messages/common/css/images/login/bk_promo_overlay3.png;<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face=Arial><span lang=EN-US style='font-size:
9.0pt;font-family:Arial'>   maybe the slow https web site has the
same problem.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=1 face=Arial><span lang=EN-US style='font-size:
9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>The
debug log:<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: posted event 100232FC<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: *1 delete posted event 100232FC<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: *1 SSL handshake handler: 1<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: *1 SSL_do_handshake: -1<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: *1 SSL_get_error: 2<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: posted event 00000000<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: worker cycle<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: select event: fd:6 wr:0<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: select event: fd:3 wr:0<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: select event: fd:7 wr:0<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: select event: fd:7 wr:1<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=DA style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: max_fd: 7<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=DA style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: select timer: 46801<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: select ready 1<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: select write 7<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=DA style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: *1 post event 100232FC<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=DA style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: timer delta: 0<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=DA style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: posted events 100232FC<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=DA style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: posted event 100232FC<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=DA style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: *1 delete posted event 100232FC<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=DA style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: *1 SSL handshake handler: 1<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=DA style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: *1 SSL_do_handshake: -1<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: *1 SSL_get_error: 2<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: posted event 00000000<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: worker cycle<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: select event: fd:6 wr:0<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: select event: fd:3 wr:0<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: select event: fd:7 wr:0<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: select event: fd:7 wr:1<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>2013/01/30
11:06:23 [debug] 19604#0: max_fd: 7<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>we
can see the write handler will repeat again and again until the
SSL_do_handshake return 1.<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>i
just repear the problem in select I/O multiplexing.<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>Can
you help me to fix this bug?<o:p></o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'><o:p> </o:p></span></font></p>

<p class=MsoNormal style='margin-left:10.5pt;mso-para-margin-left:1.0gd'><font
size=1 face=Arial><span lang=EN-US style='font-size:9.0pt;font-family:Arial'>Thanks<o:p></o:p></span></font></p>

</div>

</body>

</html>