[OpenStack-Infra] Question about zuul 2.5.2 project zuul.cmd.server.start_gear_server()

Huamin Xu dog.pythoner at gmail.com
Wed Aug 16 12:03:32 UTC 2017


Dear Senior zuul specialist

         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.

         'zuul' version is 2.5.2, when zuul server parser the zuul.conf and
get 'gearman_server'section item 'start', if true, zuul server will start
gear server.

     #zuul.cmd.server
     if (self.config.has_option('gearman_server', 'start') and

            self.config.getboolean('gearman_server', 'start')):
            self.start_gear_server()

        def start_gear_server(self):

            pipe_read, pipe_write = os.pipe()
            child_pid = os.fork()
            if child_pid == 0:
                os.close(*pipe_write*)

                .....

            else:

               os.close(*pipe_read*)

               .....


        What confused me is when to close file description created by os.pipe ?

        According to my understanding, when 'child_pid == 0' is true,
that is in child process, should close 'pipe_read' not 'pipe_write'.

        And the same is that when 'child_pid == 0' is false, that is
in parent process, should close 'pipe_write' not 'pipe_read'.

        Does my understanding right ?  If not, feel free to tell me
where am wrong ?  Very thanks.


Best Wishes

Xu Huamin  (Hangzhou, China)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-infra/attachments/20170816/da3504e9/attachment.html>


More information about the OpenStack-Infra mailing list