<div dir="ltr">Dear Senior zuul specialist<div><br></div><div>         I am a newcomer about zuul, and wanna to take your zuul into my daily work. When i go through zuul source code, i am confused in place where zuul.cmd.server.start_gear_server(), and hopeful get your help.</div><div><br></div><div>         'zuul' version is 2.5.2, when zuul server parser the zuul.conf and get '<span style="color:rgb(0,0,0);font-family:SimSun;font-size:12pt">gearman_server'section item 'start', if true, zuul server will start gear server.</span></div><div><span style="color:rgb(0,0,0);font-family:SimSun;font-size:12pt"><br></span></div><div><span style="color:rgb(0,0,0);font-family:SimSun;font-size:12pt">     #zuul.cmd.server</span></div><div><span style="color:rgb(0,0,0);font-family:SimSun;font-size:12pt">     </span><span style="font-family:SimSun;font-size:12pt;color:rgb(0,0,128);font-weight:bold">if </span><span style="color:rgb(0,0,0);font-family:SimSun;font-size:12pt">(</span><span style="font-family:SimSun;font-size:12pt;color:rgb(148,85,141)">self</span><span style="color:rgb(0,0,0);font-family:SimSun;font-size:12pt">.config.has_option(</span><span style="font-family:SimSun;font-size:12pt;color:rgb(0,128,0);font-weight:bold">'gearman_server'</span><span style="color:rgb(0,0,0);font-family:SimSun;font-size:12pt">, </span><span style="font-family:SimSun;font-size:12pt;color:rgb(0,128,0);font-weight:bold">'start'</span><span style="color:rgb(0,0,0);font-family:SimSun;font-size:12pt">) </span><span style="font-family:SimSun;font-size:12pt;color:rgb(0,0,128);font-weight:bold">and</span></div><pre style="color:rgb(0,0,0);font-family:SimSun;font-size:12pt"><span style="color:rgb(0,0,128);font-weight:bold">            </span><span style="color:rgb(148,85,141)">self</span>.config.getboolean(<span style="color:rgb(0,128,0);font-weight:bold">'gearman_server'</span>, <span style="color:rgb(0,128,0);font-weight:bold">'start'</span>)):<br>            <span style="color:rgb(148,85,141)">self</span>.start_gear_server()</pre><pre style="color:rgb(0,0,0);font-family:SimSun;font-size:12pt">        def <span style="font-size:12pt">start_gear_server(</span><span style="font-size:12pt;color:rgb(148,85,141)">self</span><span style="font-size:12pt">):</span></pre><pre style="color:rgb(0,0,0);font-family:SimSun;font-size:12pt">            pipe_read, pipe_write = os.pipe()<br>            child_pid = os.fork()<br>            <span style="color:rgb(0,0,128);font-weight:bold">if </span>child_pid == <span style="color:rgb(0,0,255)">0</span>:<br>                os.close(<b>pipe_write</b>)</pre><pre style="color:rgb(0,0,0);font-family:SimSun;font-size:12pt">                .....</pre><pre style="color:rgb(0,0,0);font-family:SimSun;font-size:12pt">            else:</pre><pre style="color:rgb(0,0,0);font-family:SimSun;font-size:12pt">               os<span style="font-size:12pt">.close(<b>pipe_read</b>)</span></pre><pre style="color:rgb(0,0,0);font-family:SimSun;font-size:12pt"><span style="font-size:12pt">               .....</span></pre><pre style="color:rgb(0,0,0);font-family:SimSun;font-size:12pt"><span style="font-size:12pt"><br></span></pre><pre style="color:rgb(0,0,0);font-family:SimSun;font-size:12pt"><span style="font-size:12pt">        What confused me is when to close file description created by os.pipe ?</span></pre><pre style="font-family:SimSun;font-size:12pt"><span style="color:rgb(0,0,0)"><span style="font-size:12pt">        According to my understanding, when '</span>child_pid == 0</span><font color="#444444">' is</font><font color="#999999"> </font><font color="#444444">true, that is in child process, should close '</font>pipe_read' not 'pipe_write'.</pre><pre style="font-family:SimSun;font-size:12pt">        And the same is that when <span style="font-size:12pt">'</span>child_pid == 0<font color="#444444" style="font-size:12pt">' is</font><font color="#999999" style="font-size:12pt"> </font><font style="font-size:12pt" color="#444444">false, that is in parent process, </font><font color="#444444" style="font-size:12pt">should close '</font>pipe_write' not 'pipe_read'. </pre><pre style="font-family:SimSun;font-size:12pt">        Does my understanding right ?  If not, feel free to tell me where am wrong ?  Very thanks.</pre><pre style="font-family:SimSun;font-size:12pt"><br></pre><pre style="font-family:SimSun;font-size:12pt">Best Wishes</pre><pre style="font-family:SimSun;font-size:12pt">Xu Huamin  (Hangzhou, China)</pre></div>