Skip to content

Socket connection problems when using Roadrunner/Swoole (Octane) #141

@alexc-hollywood

Description

@alexc-hollywood

I've been using this with the Laravel wrapper (https://github.com/hedii/laravel-gelf-logger) for a long while and it's been working flawlessly. It's working as a bridge to send log data from Laravel directly to Seq (https://datalust.co/).

Example configuration in config/logging.php:

        'seq' => [
            'driver' => 'custom',
            'via' => \Hedii\LaravelGelfLogger\GelfLoggerFactory::class,
            'processors' => [\Hedii\LaravelGelfLogger\Processors\NullStringProcessor::class,],
            'level' => env('GELF_MIN_LEVEL', 'debug'),
            'name' => env('GELF_CHANNEL', 'acme'),
            'system_name' => env('GELF_SOURCE', 'laravel'),
            'transport' => env('GELF_TRANSPORT', 'tcp'),
            'host' => env('GELF_HOST', '127.0.0.1'),
            'port' => env('GELF_PORT', 12201),
            'path' => env('GELF_HTTP_PATH', null),
            'max_length' => null,
            'context_prefix' => null,
            'extra_prefix' => null,
        ],

On a single request/response cycle it works fine, however that changes when you switch it to an Octane-based container which holds the code in memory, such as https://github.com/Anteris-Dev/docker-laravel-roadrunner . When it's running with the log channel set to a text file, it works as expected.

But when you switch it to GELF-based logging (e.g. Seq), only the first log entries are created once the framework has been cached on its first run. Any subsequent log entries fail to appear. It's like the connection isn't implicitly closed once the message has been sent via its transport.

To reproduce:

  1. Create a POST endpoint which logs traffic and payload.
  2. Establish a baseline by sending 10 looped POST requests to it, using FPM and text-based logging.
  3. Switch to Seq logging and confirm the behaviour is identical (10 requests appearing in the event log).
  4. Change to Octane-based PHP and repeat with text-based logging. Confirm it is identical.
  5. Switch to Seq logging and watch in real time. Only the first POST will be logged.

Probably not a bug, but worth bringing up for the purposes of investigation. It's an excellent package and it would be great to combine it with the performance of Roadrunner and/or Swoole.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions