woker.php 里有报错的信息

codeninjia
    public function acceptConnection($socket)
    {
        // Accept a connection on server socket.
        $new_socket = @stream_socket_accept($socket, 0, $remote_address);
        // Thundering herd.
        if (!$new_socket) {
            return;
        }

        // TcpConnection.
        $connection                         = new TcpConnection($new_socket, $remote_address);
        $this->connections = $connection;
        $connection->worker                 = $this;
        $connection->protocol               = $this->protocol;
        $connection->transport              = $this->transport;
        $connection->onMessage              = $this->onMessage;
        $connection->onClose                = $this->onClose;
        $connection->onError                = $this->onError;
        $connection->onBufferDrain          = $this->onBufferDrain;
        $connection->onBufferFull           = $this->onBufferFull;

        // Try to emit onConnect callback.
        if ($this->onConnect) {
            try {
                call_user_func($this->onConnect, $connection);
            } catch (\Exception $e) {
                self::log($e);
                exit(250);
            } catch (\Error $e) {
                self::log($e);
                exit(250);
            }
        }
    }

这个 “ stream_socket_accept”” 这里会报出错误 stream_socket_accept(): accept failed: Resource temporarily unavailable
在群里问了说是不影响。但是还是想知道为什么

2437 1 0
1个回答

walkor 打赏

stream_socket_accept是从系统连接队列里获取一个socket连接,这个操作不一定成功,比如有其它进程已经调用stream_socket_accept把最后一个socket从队列里取出,当前进程调用就返回失败,可能会触发一个waring,但是这个并不影响。而且workerman源码里用@抑制了错误。

  • codeninjia 2018-04-17

    恩懂了。是我用 error_get_last 的时候获取了这个错误有这个疑问,所以想问个清楚谢谢大大。

年代过于久远,无法发表回答
×
🔝