spiral-modules / php-grpc

:electric_plug: Fast and furious GRPC server for PHP applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: [grpc]: unable to connect to worker: unexpected response, header is missing: signal: killed

dustinblue opened this issue · comments

Hi, not sure where else to get help with this. Trying to get the example grpc echo service working. I'm unable to get any type of php error message to identify what is happening.

root@e058d9d94b68:/app# ./rr-grpc -v       
RoadRunner, PHP Application Server
Version: 1.4.1, 2020-10-13T16:08:49+0300
root@e058d9d94b68:/app# ./rr-grpc -v serve
DEBU[0000] [metrics]: disabled                          
DEBU[0000] [rpc]: started                               
DEBU[0000] [grpc]: started                              
ERRO[0000] [grpc]: [grpc]: unable to connect to worker: unexpected response, header is missing: signal: killed 
DEBU[0000] [rpc]: stopped                               
Error: [grpc]: unable to connect to worker: unexpected response, header is missing: signal: killed
root@e058d9d94b68:/app# php -v
PHP 7.2.24 (cli) (built: Oct 25 2019 04:29:43) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
root@e058d9d94b68:/app# php worker.php 
(no output)
<?php
/**
 * Sample GRPC PHP server.
 */

use Spiral\Goridge;
use Spiral\RoadRunner;

ini_set('display_errors', 'stderr');
require "vendor/autoload.php";

//To run server in debug mode - new \Spiral\GRPC\Server(null, ['debug' => true]);
$server = new \Spiral\GRPC\Server(null, ['debug' => true]);
$server->registerService(\Service\EchoInterface::class, new EchoService());

$w = new RoadRunner\Worker(new Goridge\StreamRelay(STDIN, STDOUT));
$server->serve($w);
grpc:
  listen: "tcp://localhost:9001"
  proto: "service.proto"
  workers:
    command: "php worker.php"
    pool:
      numWorkers: 1
      maxJobs: 1

Can you share more info on the environment?

What OS. Did the composer install work?

Environment is a docker container based on php:7.2-fpm which is debian buster. composer is working fine.

root@e05839de1e82:/app# cat composer.json 
{
  "require": {
    "spiral/php-grpc": "^1.0"
  },
  "autoload": {
    "psr-4": {
      "": "src/"
    }
  }
}
root@e05839de1e82:/app# composer update spiral/php-grpc
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
  - Updating spiral/php-grpc (v1.4.1 => v1.4.2): Downloading (100%)         
Writing lock file
Generating autoload files
11 packages you are using are looking for funding.
Use the `composer fund` command to find out more!

Closing this issue. There was a new line above the <?php tag in EchoService.php. I owe someone a beer or 2