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

Incorrect behavior of http:reset (error_log handler is lost) #76

Closed
Keksov opened this issue Dec 26, 2018 · 1 comment
Closed

Incorrect behavior of http:reset (error_log handler is lost) #76

Keksov opened this issue Dec 26, 2018 · 1 comment
Assignees
Labels
B-bug Bug: bug, exception

Comments

@Keksov
Copy link

Keksov commented Dec 26, 2018

Consider the following php code main.php:

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

ini_set( 'display_errors', 'stderr' );

require_once( 'vendor/autoload.php' );

$worker = new RoadRunner\Worker( new Goridge\StreamRelay( STDIN, STDOUT ) );
$psr7 = new RoadRunner\PSR7Client( $worker );

while ( $req = $psr7->acceptRequest() ) {
    try {
        $resp = new \Zend\Diactoros\Response();

        $msg = 'msg 1';
        error_log( $msg );
        $resp->getBody()->write( $msg );

        $psr7->respond( $resp );
    } catch ( \Throwable $e ) {
        $psr7->getWorker()->error((string)$e);
    }
}

Note the lines:

ini_set( 'display_errors', 'stderr' );
        $msg = 'msg 1';
        error_log( $msg );
        $resp->getBody()->write( $msg );

rr.json

{
  "http": {
    "address": "0.0.0.0:8880",
    "workers": {
      "command": "/usr/bin/php /home/foo/src/boo/main.php",
      "pool": {
        "numWorkers": 4
      }
    }
  }
}

Start rr with the command: ~/bin/roadrunner/1.2.6/rr serve -d -v -c rr.json and send a http request to it. You'll see the msg 1 in console of your terminal and browser window.

Now change msg 1 to say msg 2 and reset rr with the following command ~/bin/roadrunner/1.2.6/rr http:reset -d -v -c rr.json Send a http request again, you'll see msg 2 in browser, but not in terminal window.

It looks like rr has a problem with stderr after reset.

@wolfy-j wolfy-j added the B-bug Bug: bug, exception label Dec 26, 2018
@wolfy-j wolfy-j self-assigned this Dec 26, 2018
@wolfy-j wolfy-j changed the title Incorrect behavior of http:reset Incorrect behavior of http:reset (error_log handler is lost) Dec 26, 2018
@wolfy-j
Copy link
Contributor

wolfy-j commented Dec 26, 2018

Found and fixed in 1.2.8

@wolfy-j wolfy-j closed this as completed Dec 26, 2018
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
None yet
Development

No branches or pull requests

2 participants