Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
fix signal handling in wait() on calls to stop()#11436
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
fabpot commentedJul 22, 2014
ping@romainneutron |
romainneutron commentedJul 22, 2014
The principle is right. However, I think we should store the latest signal value that has been sent and compare it with the |
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.
This would produce
if ($this->processInformation['signaled'] && $this->processInformation['termsig'] === $this->lastestSignal) {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.
Does this work? From what I see, with this change the exception wouldn't be thrown anymore even when the process was terminated with the UNIXkill command.
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.
The purpose of the bug fix is to avoid sending an exception when the underlying process is signaled by the process component.
When we call theProcess::stop method, we just send a signal to the underlying process.
kill is excatly the same as ourProcess::signal method : it sends a signal to a process.
Using the way I propose, any signal sent outside the Process component (using kill for example) would trigger the exception, not the ones sent by the Process component
Hope I'm clear enough :)
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.
So, if I understand you correctly, the latest signal has to be modified insidestop() and insidesignal() to be handled correctly?
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.
@romainneutron I added an additional commit. If that's what you had in mind, I'll drop the first commit.
romainneutron commentedJul 23, 2014
@xabbuh this approach is much better. However, we should update the way Process::stop works: At line 664, the underlying process is signaled ( proc_terminate($this->process); Instead of that, we should signal it with our custom method and the appropriate signal.proc_terminate use SIGTERM (15) as default value, so it should be replaced with $this->doSignal(15); Then, changes introduced in Process::stop at line 679 and 680 should be removed |
xabbuh commentedJul 24, 2014
@romainneutron I updated it accordingly. However, I was not quite sure if it is better to use 15 or the Not sure why two timeout related tests are failing now. I will have a deeper look at them. |
romainneutron commentedJul 25, 2014
This is related to the sigchild environment. Before your change we were not detecting sigchild environment before signaling the underlying process with I'll have a look on this today |
romainneutron commentedJul 25, 2014
I've fixed unit tests inromainneutron@ec2f0ed You can cherry-pick my commit in your branch. |
xabbuh commentedJul 25, 2014
@romainneutron Thank you very much for your help! I added your commit and now all tests succeed. |
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.
Can you add a comment regarding the line below?
// given `SIGTERM` may not be defined and that `proc_terminate` uses the constant value and not the constant itself, we use the same hereThere 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.
Of course, it's done now. Do you think we should replace the usage of those constants in some of the other lines where they are used?
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.
no, not needed
romainneutron commentedJul 25, 2014
Once the comment has been added, 👍 |
wait() throws an exception when the process was terminated by a signal.This should not happen when the termination was requested by callingeither the stop() or the signal() method (for example, inside a callbackwhich is passed to wait()).
fabpot commentedJul 25, 2014
👍 |
romainneutron commentedJul 25, 2014
Thank you@xabbuh. |
…romainneutron)This PR was merged into the 2.3 branch.Discussion----------fix signal handling in wait() on calls to stop()| Q | A| ------------- | ---| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#11286| License | MIT| Doc PR |``wait()`` throws an exception when the process was terminated by a signal. This should not happen when the termination was requested by calling the ``stop()`` method (for example, inside a callback which is passed to ``wait()``).Commits-------5939d34 [Process] Fix unit tests in sigchild environmenteb68662 [Process] fix signal handling in wait()94ffc4f bug#11469 [BrowserKit] Fixed server HTTP_HOST port uri conversion (bcremer, fabpot)103fd88 [BrowserKit] refactor code and fix unquoted regexf401ab9 Fixed server HTTP_HOST port uri conversion045cbc5 bug#11425 Fix issue described in#11421 (Ben, ben-rosio)f5bfa9b bug#11423 Pass a Scope instance instead of a scope name when cloning a container in the GrahpvizDumper (jakzal)3177be5 minor#11464 [Translator] Use quote to surround invalid locale (lyrixx)c9742ef [Translator] Use quote to surround invalid locale4dbe0e1 bug#11120 [2.3][Process] Reduce I/O load on Windows platform (romainneutron)797d814 bug#11342 [2.3][Form] Check if IntlDateFormatter constructor returned a valid object before using it (romainneutron)0b5348e minor#11441 [Translator] Optimize assertLocale regexp (Jérémy Derussé)537c39b Optimize assertLocale regexp4cf50e8 Bring code into standard9f4313c [Process] Add test to verify fix for issue#1142102eb765 [Process] Fixes issue#114216787669 [DependencyInjection] Pass a Scope instance instead of a scope name.9572918 bug#11411 [Validator] Backported#11410 to 2.3: Object initializers are called only once per object (webmozart)291cbf9 [Validator] Backported#11410 to 2.3: Object initializers are called only once per objectefab884 bug#11403 [Translator][FrameworkBundle] Added @ to the list of allowed chars in Translator (takeit)3176f8b [Translator][FrameworkBundle] Added @ to the list of allowed chars in Translator91e32f8 bug#11381 [2.3] [Process] Use correct test for empty string in UnixPipes (whs, romainneutron)45df2f3 minor#11397 [2.3][Process] Fix unit tests on Windows platform (romainneutron)cec0a45 [Process] Adjust PR#11264, make it Windows compatible and fix CSd418935 [Process] Fix unit tests on Windows platformff0bb01 [Process] Reduce I/O load on Windows platformace5a29 bumped Symfony version to 2.3.1975e07e6 updated VERSION for 2.3.184a12f4d update CONTRIBUTORS for 2.3.1898b891d updated CHANGELOG for 2.3.1806a80fb Validate locales sets intos translator06fc97e feature#11367 [HttpFoundation] Fix to prevent magic bytes injection in JSONP responses... (CVE-2014-4671) (Andrew Moore)3c54659 minor#11387 [2.3] [Validator] Fix UserPassword validator translation (redstar504)73d50ed Fix UserPassword validator translation93a970c bug#11386 Remove Spaceless Blocks from Twig Form Templates (chrisguitarguy)8f9ed3e Remove Spaceless Blocks from Twig Form Templates9e1ea4a [Process] Use correct test for empty string in UnixPipes6af3d05 [HttpFoundation] Fix to prevent magic bytes injection in JSONP responses (PreventsCVE-2014-4671)ebf967d [Form] Check if IntlDateFormatter constructor returned a valid object before using it
wait()throws an exception when the process was terminated by a signal. This should not happen when the termination was requested by calling thestop()method (for example, inside a callback which is passed towait()).