# Buggy code
def start(self):
    """\
        Initialize the arbiter. Start listening and set pidfile if needed.
        """
    self.log.info("Starting gunicorn %s", __version__)

    if "GUNICORN_PID" in os.environ:
        self.master_pid = int(os.environ.get("GUNICORN_PID"))
        self.proc_name = self.proc_name + ".2"
        self.master_name = "Master.2"

    self.pid = os.getpid()
    if self.cfg.pidfile is not None:
        pidname = self.cfg.pidfile
        if self.master_pid != 0:
            pidname += ".2"
        self.pidfile = Pidfile(pidname)
        self.pidfile.create(self.pid)
    self.cfg.on_starting(self)

    self.init_signals()

    if not self.LISTENERS:
        fds = []

        listen_fds = systemd.listen_fds()
        if listen_fds:
            self.systemd = True
            fds = range(
                systemd.SD_LISTEN_FDS_START, systemd.SD_LISTEN_FDS_START + listen_fds
            )

        elif self.master_pid:
            for fd in os.environ.pop("GUNICORN_FD").split(","):
                fds.append(int(fd))

        self.LISTENERS = sock.create_sockets(self.cfg, self.log, fds)

    listeners_str = ",".join([str(l) for l in self.LISTENERS])
    self.log.debug("Arbiter booted")
    self.log.info("Listening at: %s (%s)", listeners_str, self.pid)
    self.log.info("Using worker: %s", self.cfg.worker_class_str)

    # check worker class requirements
    if hasattr(self.worker_class, "check_config"):
        self.worker_class.check_config(self.cfg, self.log)

    self.cfg.when_ready(self)


# Traceback (IndexError)
Traceback (most recent call last):
File "/home/berker/projects/gunicorn/gunicorn/arbiter.py", line 574, in spawn_worker
worker.init_process()
File "/home/berker/projects/gunicorn/gunicorn/workers/base.py", line 140, in init_process
self.run()
File "/home/berker/projects/gunicorn/gunicorn/workers/sync.py", line 124, in run
self.run_for_one(timeout)
File "/home/berker/projects/gunicorn/gunicorn/workers/sync.py", line 59, in run_for_one
listener = self.sockets[0]
IndexError: list index out of range

# Fixed code
def start(self):
    """\
        Initialize the arbiter. Start listening and set pidfile if needed.
        """
    self.log.info("Starting gunicorn %s", __version__)

    if "GUNICORN_PID" in os.environ:
        self.master_pid = int(os.environ.get("GUNICORN_PID"))
        self.proc_name = self.proc_name + ".2"
        self.master_name = "Master.2"

    self.pid = os.getpid()
    if self.cfg.pidfile is not None:
        pidname = self.cfg.pidfile
        if self.master_pid != 0:
            pidname += ".2"
        self.pidfile = Pidfile(pidname)
        self.pidfile.create(self.pid)
    self.cfg.on_starting(self)

    self.init_signals()

    if not self.LISTENERS:
        fds = None
        listen_fds = systemd.listen_fds()
        if listen_fds:
            self.systemd = True
            fds = range(
                systemd.SD_LISTEN_FDS_START, systemd.SD_LISTEN_FDS_START + listen_fds
            )

        elif self.master_pid:
            fds = []
            for fd in os.environ.pop("GUNICORN_FD").split(","):
                fds.append(int(fd))

        self.LISTENERS = sock.create_sockets(self.cfg, self.log, fds)

    listeners_str = ",".join([str(l) for l in self.LISTENERS])
    self.log.debug("Arbiter booted")
    self.log.info("Listening at: %s (%s)", listeners_str, self.pid)
    self.log.info("Using worker: %s", self.cfg.worker_class_str)

    # check worker class requirements
    if hasattr(self.worker_class, "check_config"):
        self.worker_class.check_config(self.cfg, self.log)

    self.cfg.when_ready(self)