src/ProcessManager.php
public function onSlaveClosed(ConnectionInterface $connection)
    {
        if ($this->status === self::STATE_SHUTDOWN) {
            return;
        }

        try {
            $slave = $this->slaves->getByConnection($connection);
        } catch (\Exception $e) {
            // this connection is not registered, so it died during the ProcessSlave constructor.
            $this->output->writeln(
                '<error>Worker permanently closed during PHP-PM bootstrap. Not so cool. ' .
                'Not your fault, please create a ticket at github.com/php-pm/php-pm with ' .
                'the output of `ppm start -vv`.</error>'
            );

            return;
        }

        // remove slave from reload killer pool
        unset($this->slavesToReload[$slave->getPort()]);

        // get status before terminating
        $status = $slave->getStatus();
        $port = $slave->getPort();

        if ($this->output->isVeryVerbose()) {
            $this->output->writeln(sprintf('Worker #%d closed after %d handled requests', $port, $slave->getHandledRequests()));
        }

        // kill slave and remove from pool
        $this->terminateSlave($slave);

        /*
         * If slave is in registered state it died during bootstrap.
         * In this case new instances should only be created:
         * - in debug mode after file change detection via restartSlaves()
         * - in production mode immediately
         */
        if ($status === Slave::REGISTERED) {
            $this->bootstrapFailed($port);
        } else {
            // recreate
            $this->newSlaveInstance($port);
        }
    }
public function onSlaveClosed(ConnectionInterface $connection)
    {
        if ($this->status === self::STATE_SHUTDOWN) {
            return;
        }

        try {
            $slave = $this->slaves->getByConnection($connection);
        } catch (\Exception $e) {
            // this connection is not registered, so it died during the ProcessSlave constructor.
            $this->output->writeln(
                '<error>Worker permanently closed during PHP-PM bootstrap. Not so cool. ' .
                'Not your fault, please create a ticket at github.com/php-pm/php-pm with ' .
                'the output of `ppm start -vv`.</error>'
            );

            return;
        }

        // remove slave from reload killer pool
        unset($this->slavesToReload[$slave->getPort()]);

        // get status before terminating
        $status = $slave->getStatus();
        $port = $slave->getPort();

        if ($this->output->isVeryVerbose()) {
            $this->output->writeln(sprintf('Worker #%d closed after %d handled requests', $port, $slave->getHandledRequests()));
        }

        // kill slave and remove from pool
        $this->terminateSlave($slave);

        /*
         * If slave is in registered state it died during bootstrap.
         * In this case new instances should only be created:
         * - in debug mode after file change detection via restartSlaves()
         * - in production mode immediately
         */
        if ($status === Slave::REGISTERED) {
            $this->bootstrapFailed($port);
        } else {
            // recreate
            $this->newSlaveInstance($port);
        }
    }
public function onSlaveClosed ( ConnectionInterface $ connection ) { if ( $ this -> status === self :: STATE_SHUTDOWN ) { return ; } try { $ slave = $ this -> slaves -> getByConnection ( $ connection ) ; } catch ( \ Exception $ e ) { // this connection is not registered, so it died during the ProcessSlave constructor. $ this -> output -> writeln ( '<error>Worker permanently closed during PHP-PM bootstrap. Not so cool. ' . 'Not your fault, please create a ticket at github.com/php-pm/php-pm with ' . 'the output of `ppm start -vv`.</error>' ) ; return ; } // remove slave from reload killer pool unset ( $ this -> slavesToReload [ $ slave -> getPort ( ) ] ) ; // get status before terminating $ status = $ slave -> getStatus ( ) ; $ port = $ slave -> getPort ( ) ; if ( $ this -> output -> isVeryVerbose ( ) ) { $ this -> output -> writeln ( sprintf ( 'Worker #%d closed after %d handled requests' , $ port , $ slave -> getHandledRequests ( ) ) ) ; } // kill slave and remove from pool $ this -> terminateSlave ( $ slave ) ; /*
         * If slave is in registered state it died during bootstrap.
         * In this case new instances should only be created:
         * - in debug mode after file change detection via restartSlaves()
         * - in production mode immediately
         */ if ( $ status === Slave :: REGISTERED ) { $ this -> bootstrapFailed ( $ port ) ; } else { // recreate $ this -> newSlaveInstance ( $ port ) ; } }
Handle slave closed

@param ConnectionInterface $connection
@return void
Handle slave closed