-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Process] Enhance compatiblity with --enable-sigchild #16915
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
Conversation
|
||
$process->wait(); | ||
$this->assertSame($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after wait'); | ||
$this->assertContains($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after wait'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why changing these conditions ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because there are too much tightened to implementation details, and in fact do not work when testing with a sighchild enabled php
b9395dc
to
deab96b
Compare
*/ | ||
public function hasBeenSignaled() | ||
{ | ||
$this->requireProcessIsTerminated(__FUNCTION__); | ||
|
||
if ($this->isSigchildEnabled()) { | ||
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are now able to retrieve it when enhancing compat, but can we also without enhancing it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
knowing "if" it has been signaled works with or without enhanced mode thanks to https://github.com/symfony/symfony/pull/16915/files#diff-f9f2411040cda7b73402481facf3e4ddR1133
knowing which signal is more tricky and requires enhanced mode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in fact, I was wrong, knowing "if" it has been signaled doesn't work without the enhanced mode, fixed
14d13ee
to
7b11f1f
Compare
Comments addressed, ready for a second round of review :) |
Sorry not able to review in depth right now but I sure hope it won't blow up anything. Then again I think sigchild usage is probably less and less of a problem the more time passes. |
8cadae4
to
e36b1b4
Compare
I added a special build of php with sigchild enabled on travis so that we can test, verify, prove and enforce that this really works :) |
e36b1b4
to
36fb047
Compare
throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.'); | ||
} | ||
|
||
$this->updateStatus(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updateStatus is already called by requireProcessIsTerminated
b2d9c18
to
bd38abd
Compare
@@ -32,6 +33,7 @@ env: | |||
|
|||
before_install: | |||
- if [[ "$deps" = "no" ]] && [[ "$TRAVIS_PHP_VERSION" =~ 5.[45] ]] && [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then export deps=skip; fi; | |||
- if [[ $deps = no && $TRAVIS_PHP_VERSION = 5.3 && ! -d php-5.3.9/sapi ]]; then wget http://museum.php.net/php5/php-5.3.9.tar.bz2; tar -xjf php-5.3.9.tar.bz2; (cd php-5.3.9; ./configure --enable-sigchild --enable-pcntl; make -j2); fi; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume that the version will have to change for the 3.0 branch ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I propose 5.5.9 there
@nicolas-grekas have you tried running tests when forcing the sighchild compat layer to be disabled ? |
@stof yes. Nothing interesting here: tests either fail because of one of those exceptions about --enable-sigchild, or pass. |
@nicolas-grekas but it needs to be done to ensure we don't miss some of the sigchild checks |
bd38abd
to
24bd3a2
Compare
Sigchild is now tested with and without the enhanced mode.
|
24bd3a2
to
db6239d
Compare
Looks good to me |
070bf65
to
db6239d
Compare
db6239d
to
e7cc4aa
Compare
{ | ||
$process = new Process($commandline, $cwd, $env, $stdin, $timeout, $options); | ||
|
||
if (false !== $enhance = getenv('ENHANCE_SIGCHLD')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aren't you missing a I
in the name ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SIGCHLD is the name of the said signal, so it was intentional...
except for the comment I made, 👍 |
…olas-grekas) This PR was merged into the 2.3 branch. Discussion ---------- [Process] Enhance compatiblity with --enable-sigchild | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #16888 | License | MIT | Doc PR | - This is complete rewrite of the fallback `--enable-sigchild` handling in the Process class. It removes most of the differences between this and a non-sigchild-enabled php. Which means the test suite doesn't need anymore to be replayed 3 times (which is how I started this PR, looking for a way to test this component in less time). I validated this with a locally compiled php, sigchild-enabled. Green. Changes affect only this special-mode php. Ping @romainneutron and @Seldaek (original writer of the sigchild support) Submitted on 2.3 as bugfix, which it is to me. Commits ------- e7cc4aa [Process] Enhance compatiblity with --enable-sigchild
|
||
$this->commandline = '('.$this->commandline.') 3>/dev/null; code=$?; echo $code >&3; exit $code'; | ||
$this->commandline = $trap.'{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A comment explaining what's done in this commandline, with a link to the stackoverflow issue would be more than welcome.
I doubt anybody could read this without error in two years (thinking about the first implementation was years ago)
This is complete rewrite of the fallback
--enable-sigchild
handling in the Process class.It removes most of the differences between this and a non-sigchild-enabled php.
Which means the test suite doesn't need anymore to be replayed 3 times (which is how I started this PR, looking for a way to test this component in less time).
I validated this with a locally compiled php, sigchild-enabled. Green.
Changes affect only this special-mode php.
Ping @romainneutron and @Seldaek (original writer of the sigchild support)
Submitted on 2.3 as bugfix, which it is to me.