Skip to content

Upgrade React/Http to v0.8 - #271

Merged
andig merged 3 commits into
php-pm:masterfrom
andig:react-0.8
Nov 21, 2017
Merged

andig merged 3 commits into
php-pm:masterfrom
andig:react-0.8

Conversation

@andig

@andig andig commented Oct 2, 2017

Copy link
Copy Markdown
Contributor

Follow-up of #226, rebased to current master. Still need to:

Supplemented by php-pm/php-pm-httpkernel#63 and php-pm/php-pm-psr7#12

Follow-up topics to be addressed separately (removed todo marker):

ping @maciejmrozinski

@andig andig changed the title ReactHttp 0.8 Upgrade React/Http to v0.8 Oct 3, 2017
Comment thread Bridges/BridgeInterface.php Outdated
*
* @return ResponseInterface
*/
// public function handle(ServerRequestInterface $request);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for clarity for me- will remove.

@andig

andig commented Oct 3, 2017

Copy link
Copy Markdown
Contributor Author

@kelunik can I ask you for help here: https://github.com/php-pm/php-pm/pull/271/files#diff-42edefc6558e3945be063a8a1e5019a7R345 ?

I'm always getting HTTP 400 back from the slave. Somethings wrong with the way I setup the HTTP Server (or the underlying socket). After banging my head against the wall for two hours now I would appreciate any hep I can get..

@andig

andig commented Oct 3, 2017

Copy link
Copy Markdown
Contributor Author

@kelunik found the problem, investigating here

This was referenced Oct 19, 2017
@andig

andig commented Oct 22, 2017

Copy link
Copy Markdown
Contributor Author

not working yet is UDS on OSX (waiting for react/socket release this weekend, workaround included) and chunked request handling (waiting for react/http merge).

@andig

andig commented Oct 23, 2017

Copy link
Copy Markdown
Contributor Author

@ALL I can now successfully run a simple non-Symfony application on top of this PR. I have not been able to test Symfony or Laravel and would appreciate some help it order to make progress.

These steps are required for testing.

  1. add the following section to your composer.json
"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/andig/php-pm"
    },
    {
        "type": "vcs",
        "url": "https://github.com/andig/php-pm-httpkernel"
    }
]
  1. then install php-pm into your project
composer require php-pm/php-pm:dev-react-0.8 php-pm/httpkernel-adapter:dev-react-0.8 react/http:dev-master
  1. start ppm from the vendor/bin folder

@andig

andig commented Oct 30, 2017

Copy link
Copy Markdown
Contributor Author

ping @marcj it doesn't seem like we're getting any test feedback on this one except mine sofar (and I'm not a symfony expert). What's your take on merging this and fixing errors that will be contained going forward? Maybe tag a 0.1 version before merging on all repos and then merge the various contained PRs after cleanup of the VCS aliases? Even though we'll not be on stable react/http versions yet it will at least give us dev-master instead of an old commit.

@andig

andig commented Nov 9, 2017

Copy link
Copy Markdown
Contributor Author

I'm giving up. Without any testing this PR won't get anywhere :(

@andig

andig commented Nov 18, 2017

Copy link
Copy Markdown
Contributor Author

@marcj with the requirement changes in react/http ppm is no longer installable. Unless you object I'd merge this and the associated PRs in order to get back to basic installability plus bugfixes going forward.

Please let me know if you disagree.

@andig andig reopened this Nov 18, 2017
Comment thread composer.json
"react/socket": "^0.5.0",
"mkraemer/react-pcntl": "2.0.*",
"react/stream": "^0.7.1",
"react/http": "dev-master",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest targeting the specific commit hash until the next release is tagged 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn‘t matter. I‘ll just keep this PR updated until tagged release is available.

@andig

andig commented Nov 21, 2017

Copy link
Copy Markdown
Contributor Author

Rebased and squashed to prepare for merging. All tests are passing now :)

Comment thread Commands/ConfigTrait.php
if ($config['populate-server-var'] === true && $config['concurrent-requests'] === true) {
$output->writeln('<error>PPM cannot populate $_SERVER var while processing concurrent requests, disable one of options</error>');
exit(1);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should just remove concurrent requests, see #268.

Comment thread ProcessManager.php
*
* @var bool
*/
protected $populateServer = true;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is something the adapter should care about instead?

@marcj

marcj commented Nov 21, 2017

Copy link
Copy Markdown
Member

Do we know when react/http 0.8 will be released? @andig @clue.

I'll test this PR now and provide feedback later.

@marcj

marcj commented Nov 21, 2017

Copy link
Copy Markdown
Member

Current exceptions I get:

php_1  | string(5691) "Symfony\Component\Debug\Exception\ContextErrorException: Notice: Undefined variable: response in /srv/www/vendor/php-pm/php-pm/ProcessSlave.php:508
php_1  | Stack trace:
php_1  | #0 /srv/www/vendor/php-pm/php-pm/ProcessSlave.php(428): PHPPM\ProcessSlave->serveStatic(Object(React\Http\Io\ServerRequest))
php_1  | #1 /srv/www/vendor/php-pm/php-pm/ProcessSlave.php(396): PHPPM\ProcessSlave->handleRequest(Object(React\Http\Io\ServerRequest))
php_1  | #2 /srv/www/vendor/react/http/src/MiddlewareRunner.php(47): PHPPM\ProcessSlave->onRequest(Object(React\Http\Io\ServerRequest), Object(Closure))
php_1  | #3 /srv/www/vendor/react/promise/src/Promise.php(208): React\Http\MiddlewareRunner->React\Http\{closure}(Object(Closure), Object(Closure), Object(Closure))
php_1  | #4 /srv/www/vendor/react/promise/src/Promise.php(19): React\Promise\Promise->call(Object(Closure))
php_1  | #5 /srv/www/vendor/react/http/src/MiddlewareRunner.php(55): React\Promise\Promise->__construct(Object(Closure), Object(Closure))
php_1  | #6 /srv/www/vendor/react/http/src/Middleware/RequestBodyParserMiddleware.php(23): React\Http\MiddlewareRunner->React\Http\{closure}(Object(React\Http\Io\ServerRequest))
php_1  | #7 /srv/www/vendor/react/http/src/MiddlewareRunner.php(47): React\Http\Middleware\RequestBodyParserMiddleware->__invoke(Object(React\Http\Io\ServerRequest), Object(Closure))
php_1  | #8 /srv/www/vendor/react/promise/src/Promise.php(208): React\Http\MiddlewareRunner->React\Http\{closure}(Object(Closure), Object(Closure), Object(Closure))
php_1  | #9 /srv/www/vendor/react/promise/src/Promise.php(19): React\Promise\Promise->call(Object(Closure))
php_1  | #10 /srv/www/vendor/react/http/src/MiddlewareRunner.php(55): React\Promise\Promise->__construct(Object(Closure), Object(Closure))
php_1  | #11 /srv/www/vendor/react/http/src/Middleware/RequestBodyBufferMiddleware.php(49): React\Http\MiddlewareRunner->React\Http\{closure}(Object(React\Http\Io\ServerRequest))
php_1  | #12 /srv/www/vendor/react/promise/src/FulfilledPromise.php(25): React\Http\Middleware\RequestBodyBufferMiddleware->React\Http\Middleware\{closure}('')
php_1  | #13 /srv/www/vendor/react/promise/src/Promise.php(119): React\Promise\FulfilledPromise->then(Object(Closure), Object(Closure))
php_1  | #14 /srv/www/vendor/react/promise/src/Promise.php(166): React\Promise\Promise->React\Promise\{closure}(Object(React\Promise\FulfilledPromise))
php_1  | #15 /srv/www/vendor/react/promise/src/Promise.php(133): React\Promise\Promise->settle(Object(React\Promise\FulfilledPromise))
php_1  | #16 /srv/www/vendor/react/promise/src/Promise.php(201): React\Promise\Promise->resolve('')
php_1  | #17 /srv/www/vendor/react/promise/src/FulfilledPromise.php(39): React\Promise\Promise->React\Promise\{closure}('')
php_1  | #18 /srv/www/vendor/react/promise/src/Promise.php(120): React\Promise\FulfilledPromise->done(Object(Closure), Object(Closure), Object(Closure))
php_1  | #19 /srv/www/vendor/react/promise/src/Promise.php(166): React\Promise\Promise->React\Promise\{closure}(Object(React\Promise\FulfilledPromise))
php_1  | #20 /srv/www/vendor/react/promise/src/Promise.php(133): React\Promise\Promise->settle(Object(React\Promise\FulfilledPromise))
php_1  | #21 /srv/www/vendor/react/promise/src/Promise.php(201): React\Promise\Promise->resolve('')
php_1  | #22 /srv/www/vendor/react/promise-stream/src/functions.php(43): React\Promise\Promise->React\Promise\{closure}('')
php_1  | #23 [internal function]: React\Promise\Stream\{closure}()
php_1  | #24 /srv/www/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(64): call_user_func_array(Object(Closure), Array)
php_1  | #25 /srv/www/vendor/react/http/src/Io/HttpBodyStream.php(80): Evenement\EventEmitter->emit('close')
php_1  | #26 /srv/www/vendor/react/http/src/Io/HttpBodyStream.php(179): React\Http\Io\HttpBodyStream->close()
php_1  | #27 [internal function]: React\Http\Io\HttpBodyStream->handleEnd()
php_1  | #28 /srv/www/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(64): call_user_func_array(Array, Array)
php_1  | #29 /srv/www/vendor/react/http/src/Server.php(276): Evenement\EventEmitter->emit('end')
php_1  | #30 /srv/www/vendor/react/http/src/Server.php(174): React\Http\Server->handleRequest(Object(React\Socket\Connection), Object(React\Http\Io\ServerRequest))
php_1  | #31 [internal function]: React\Http\Server->React\Http\{closure}(Object(React\Http\Io\ServerRequest), '')
php_1  | #32 /srv/www/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(64): call_user_func_array(Object(Closure), Array)
php_1  | #33 /srv/www/vendor/react/http/src/Io/RequestHeaderParser.php(66): Evenement\EventEmitter->emit('headers', Array)
php_1  | #34 /srv/www/vendor/react/http/src/Io/RequestHeaderParser.php(54): React\Http\Io\RequestHeaderParser->parseAndEmitRequest(630)
php_1  | #35 [internal function]: React\Http\Io\RequestHeaderParser->feed('GET /bundles/ap...')
php_1  | #36 /srv/www/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(64): call_user_func_array(Array, Array)
php_1  | #37 /srv/www/vendor/react/stream/src/Util.php(71): Evenement\EventEmitter->emit('data', Array)
php_1  | #38 [internal function]: React\Stream\Util::React\Stream\{closure}('GET /bundles/ap...')
php_1  | #39 /srv/www/vendor/evenement/evenement/src/Evenement/EventEmitterTrait.php(64): call_user_func_array(Object(Closure), Array)
php_1  | #40 /srv/www/vendor/react/stream/src/DuplexResourceStream.php(193): Evenement\EventEmitter->emit('data', Array)
php_1  | #41 [internal function]: React\Stream\DuplexResourceStream->handleData(Resource id #1105, Object(React\EventLoop\StreamSelectLoop))
php_1  | #42 /srv/www/vendor/react/event-loop/src/StreamSelectLoop.php(236): call_user_func(Array, Resource id #1105, Object(React\EventLoop\StreamSelectLoop))
php_1  | #43 /srv/www/vendor/react/event-loop/src/StreamSelectLoop.php(205): React\EventLoop\StreamSelectLoop->waitForStreamActivity(36785)
php_1  | #44 /srv/www/vendor/php-pm/php-pm/ProcessSlave.php(355): React\EventLoop\StreamSelectLoop->run()
php_1  | #45 /tmp/dbglncJcj(23): PHPPM\ProcessSlave->run()
php_1  | #46 {main}"

@marcj

marcj commented Nov 21, 2017

Copy link
Copy Markdown
Member

Except that static file serving (I commented it out to continue testing) everything works great so far in my regular Symfony app. :)

@clue

clue commented Nov 23, 2017

Copy link
Copy Markdown
Contributor

Happy to see this has landed! :shipit: 🎉

@marcj Do we know when react/http 0.8 will be released? @andig @clue.

We've set up a roadmap with the open issues for the v0.8 release (https://github.com/reactphp/http/milestone/14). We're currently working on resolving the outstanding issues and will evaluate this in one week. If everything goes according to plan, expect the release in the next couple of weeks :shipit: 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants