Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[HttpClient] CURLMOPT_PUSHFUNCTION breaks on CLI #57681

Copy link
Copy link
Closed
@aleho

Description

@aleho
Issue body actions

Symfony version(s) affected

6.4

Description

This weekend I was seeing quite a few crashes in an app processing URLs in messenger.

segfault at 20 ip 00007f96350cc937 sp 00007fffa3b202e8 error 6 in libc.so.6[7f9634fa0000+155000] likely on CPU 2 (core 1, socket 0)

Trying to reproduce the bug locally I started to see warnings on the console I've never encountered before. Apparently there was a change in an upstream service where they now push content in the Link: header since Friday.

Warning: PHP Request Shutdown: Cannot call the CURLOPT_PROGRESSFUNCTION in Unknown on line 0
PHP Warning:  PHP Request Shutdown: Cannot call the CURLOPT_PROGRESSFUNCTION in Unknown on line 0

How to reproduce

  • Inject HttpClientInterface into a command.
  • Request a URL where the server sends a Link: header.
  • Execute the command.

Possible Solution

As I don't need the resources at all (I'm only requesting the URL because I want to determine the content type, and sometimes the app gets an URL to HTML instead of e.g. images) my first idea was setting $maxPendingPushes to 0 which seems to be passed-through all the way from HttpClient to CurlClientState.

I couldn't find any documented option for that parameter (like, e.g. max_pending_pushes) so the only way I could come up with was to use a compiler pass.

<?php

declare(strict_types = 1);

namespace App\DependencyInjection;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;

class MaxPushesCompilerPass implements CompilerPassInterface
{
    #[\Override]
    public function process(ContainerBuilder $container): void
    {
        $container
            ->getDefinition('http_client.transport')
            ->setArgument('maxPendingPushes', 0);
    }
}

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.