Skip to content

[WebServer] server:start failed (OSX, php 7.3.2) #30471

Closed
@Plopix

Description

@Plopix

Symfony version(s) affected: v4.2.3
PHP version: PHP 7.3.2 on OS X installed with Brew. (pcntl present)

Description

bin/console server:start 127.0.0.1:1664

=> does not start anything on PHP 7.3 (on 7.2 it is working as expected)

  • server:start is working.
  • I debugged and when I remove the fork that is working too.

How to reproduce

composer create-project symfony/website-skeleton my_project
cd my_project
composer require server --dev
bin/console server:start 127.0.0.1:1664

Then netstat -an | grep LISTEN | grep 1664 and you will see nothing.

As soon as I switch to PHP 7.2.15, it is working again.

Additional context

I have tried to debug, using "file_put_contents" in the child (after fork).
The further I can go is in createServerProcess
This is going to be weird:

        file_put_contents("/tmp/plop", "--".PHP_EOL, FILE_APPEND);
        file_put_contents("/tmp/plop", "Before PhpExecutableFinder - ".__LINE__.PHP_EOL, FILE_APPEND);
        $finder = new PhpExecutableFinder();
        file_put_contents("/tmp/plop", "After PhpExecutableFinder - ".__LINE__.PHP_EOL, FILE_APPEND);

Result is:

--
Before PhpExecutableFinder - 149

Even weirder, if I add debug in PhpExecutableFinder constructor

    public function __construct()
    {
        file_put_contents("/tmp/plop", "Before new ExecutableFinder(); - ".__LINE__.PHP_EOL, FILE_APPEND);
        $this->executableFinder = new ExecutableFinder();
        file_put_contents("/tmp/plop", "Before new ExecutableFinder(); - ".__LINE__.PHP_EOL, FILE_APPEND);
    }

The result is THE SAME, which does not make any sense to me:

--
Before PhpExecutableFinder - 149

So I pushed the debug, trying weird things, I have removed all the comments in PhpExecutableFinder.php and magically it progressed

--
Before PhpExecutableFinder - 149
Before new ExecutableFinder(); - 9

I did the same for ExecutableFinder.php

--
Before PhpExecutableFinder - 149
Before new ExecutableFinder(); - 9
After new ExecutableFinder(); - 11
After PhpExecutableFinder - 151

But the command is still now working, the new Process is failing

    private function createServerProcess(WebServerConfig $config)
    {
        file_put_contents("/tmp/plop", "--".PHP_EOL, FILE_APPEND);
        file_put_contents("/tmp/plop", "Before PhpExecutableFinder - ".__LINE__.PHP_EOL, FILE_APPEND);
        $finder = new PhpExecutableFinder();
        file_put_contents("/tmp/plop", "After PhpExecutableFinder - ".__LINE__.PHP_EOL, FILE_APPEND);
        if (false === $binary = $finder->find(false)) {
            throw new \RuntimeException('Unable to find the PHP binary.');
        }

        $xdebugArgs = ini_get('xdebug.profiler_enable_trigger') ? ['-dxdebug.profiler_enable_trigger=1'] : [];

        file_put_contents("/tmp/plop", var_export($xdebugArgs, true).PHP_EOL, FILE_APPEND);
        file_put_contents("/tmp/plop", var_export($finder->findArguments(), true).PHP_EOL, FILE_APPEND);

        file_put_contents("/tmp/plop", var_export($config->getAddress(), true).PHP_EOL, FILE_APPEND);
        file_put_contents("/tmp/plop", var_export($config->getRouter(), true).PHP_EOL, FILE_APPEND);

        $process = new Process(array_merge([$binary], $finder->findArguments(), $xdebugArgs, ['-dvariables_order=EGPCS', '-S', $config->getAddress(), $config->getRouter()]));

        file_put_contents("/tmp/plop", "PROCESS CONSTRUCTED".PHP_EOL, FILE_APPEND);
...

So I continued, it does not enter into the constructor at all. So I removed all the comment of Process.php, and I went further... and further removing those comments from files:

  • PipesInterface
  • AbstractPipes
  • UnixPipes
  • Process

And it finally worked ... but I am lost... I think that is a PHP bug.
I tried removing OPcache, but no change.

I then tried on Docker

docker run -it --rm php:7.3.2 /bin/bash
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
mv composer.phar composer
apt-get update
apt-get install git zlib1g-dev
docker-php-ext-install zip pcntl
docker-php-ext-enable pcntl
./composer create-project symfony/website-skeleton my_project
cd my_project
../composer require server --dev
bin/console server:start 127.0.0.1:1664

=> IT WORKS.. so definitely something on Mac OS X, or PHP Brew...

Does someone reproduce this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions