Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 BUG]: RR serve plugin cannot start if the php workers immediately start sending logs to RPC (app-logger plugin) #1452

Closed
1 task done
roquie opened this issue Feb 8, 2023 · 1 comment · Fixed by roadrunner-server/endure#135
Assignees
Labels
B-bug Bug: bug, exception
Milestone

Comments

@roquie
Copy link

roquie commented Feb 8, 2023

No duplicates 🥲.

  • I have searched for a similar issue in our bug tracker and didn't find any solutions.

What happened?

Since 2.12.0 I am happy to use app-logger plugin. But with this feature, I found unexpected behavior.

It's okay if your application doesn't send logs during the bootload phase. But if the application sends such logs, we have a problem:

  • 1: PHP can't send logs over a socket connection because the rpc plugin not started yet
  • PHP workers can't to allocate because they're trying to send logs to RPC; goto 1;

Version (rr --version)

2.12.2

How to reproduce the issue?

Steps to reproduce:

  1. Create a php worker and send logs to rpc app-logger plugin right away
  2. rr serve

Configuration file:

http:
  address: 0.0.0.0:8080
  middleware:
  - gzip
  - static
  pool:
    num_workers: 4
    supervisor:
      max_worker_memory: 100
  static:
    dir: /app/public
    forbid:
    - .php
    - .htaccess
rpc:
  listen: tcp://127.0.0.1:6001
server:
  command: php /app/app.php
  relay: pipes
temporal: # temporal not required for reproduce, this is a just my copy-pasted config
  activities:
    num_workers: 12
  address: temporal-frontend:7233
version: "2.7"

Relevant log output

2023-02-07T13:56:23.024Z        INFO    temporal        connected to temporal server    {"address": "temporal-frontend:7233"}
2023-02-07T13:56:23.309Z        INFO    server          [Spiral\Goridge\Exception\RelayException]
Unable to establish connection tcp://127.0.0.1:6001
in /app/vendor/spiral/goridge/src/SocketRelay.php:281

Previous: [Spiral\Goridge\Exception\RelayException]
Connection refused
in /app/vendor/spiral/goridge/src/SocketRelay.php:278

2023-02-07T13:56:23.309Z        INFO    server          [Spiral\Exceptions\Exception\FatalException]
socket_connect(): unable to connect [111]: Connection refused
in /app/vendor/spiral/goridge/src/SocketRelay.php:269

handle_serve_command: Serve error:
        endure_start:
        endure_serve_internal: Function call error:
        endure_call_serve_fn: got initial serve error from the Vertex roadrunner_temporal.Plugin, stopping execution, error: temporal_plugin_serve: WorkerAllocate:
        static_pool_allocate_workers: EOF
@roquie roquie added B-bug Bug: bug, exception F-need-verification labels Feb 8, 2023
@rustatian rustatian added this to General Feb 8, 2023
@github-project-automation github-project-automation bot moved this to Backlog in General Feb 8, 2023
@rustatian rustatian moved this from Backlog to In Progress in General Feb 8, 2023
@rustatian rustatian added this to the v2023.1 milestone Feb 8, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Unreleased in General Feb 8, 2023
@rustatian
Copy link
Member

rustatian commented Feb 8, 2023

Done, this worker will work without any problem in the RR v2023.1.0:

<?php
/**
 * @var Goridge\RelayInterface $relay
 */
use Spiral\Goridge;
use Spiral\RoadRunner;

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

$worker = RoadRunner\Worker::create();
$psr7 = new RoadRunner\Http\PSR7Worker(
    $worker,
    new \Nyholm\Psr7\Factory\Psr17Factory(),
    new \Nyholm\Psr7\Factory\Psr17Factory(),
    new \Nyholm\Psr7\Factory\Psr17Factory()
);

$rpc = new Goridge\RPC\RPC(
    Goridge\Relay::create('tcp://127.0.0.1:6001')
);

\fwrite(STDERR, $rpc->call('rpc.Version', true)); // <--- any RPC call

// regular while loop
while{}

@rustatian rustatian moved this from Unreleased to Done in General Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-bug Bug: bug, exception
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants