8000 feature #54510 [Console] Handle SIGQUIT signal (ostrolucky) · symfony/symfony@7bedfa0 · GitHub
[go: up one dir, main page]

Skip to content
< 8000 script crossorigin="anonymous" defer="defer" type="application/javascript" src="https://github.githubassets.com/assets/vendors-node_modules_github_remote-form_dist_index_js-node_modules_delegated-events_dist_inde-94fd67-e789af5a4655.js">

Commit 7bedfa0

Browse files
committed
feature #54510 [Console] Handle SIGQUIT signal (ostrolucky)
This PR was merged into the 7.1 branch. Discussion ---------- [Console] Handle SIGQUIT signal | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | #43866 | License | MIT As both PHP-FPM and NGINX use SIGQUIT for graceful shutdown, I believe it's necessary PHP applications should also support it. It's especially important in cases where you run PHP application in container running php/nginx image, since they override shutdown signal that docker uses to SIGQUIT, see eg. nginx/docker-nginx@3fb70dd Commits ------- 43016f9 [Console] Handle SIGQUIT signal
2 parents 9549cc2 + 43016f9 commit 7bedfa0

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

src/Symfony/Component/Console/Application.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function __construct(
9797
$this->defaultCommand = 'list';
9898
if (\defined('SIGINT') && SignalRegistry::isSupported()) {
9999
$this->signalRegistry = new SignalRegistry();
100-
$this->signalsToDispatchEvent = [\SIGINT, \SIGTERM, \SIGUSR1, \SIGUSR2];
100+
$this->signalsToDispatchEvent = [\SIGINT, \SIGQUIT, \SIGTERM, \SIGUSR1, \SIGUSR2];
101101
}
102102
}
103103

@@ -984,7 +984,7 @@ protected function doRunCommand(Command $command, InputInterface $input, OutputI
984984
if (Terminal::hasSttyAvailable()) {
985985
$sttyMode = shell_exec('stty -g');
986986

987-
foreach ([\SIGINT, \SIGTERM] as $signal) {
987+
foreach ([\SIGINT, \SIGQUIT, \SIGTERM] as $signal) {
988988
$this->signalRegistry->register($signal, static fn () => shell_exec('stty '.$sttyMode));
989989
}
990990
}

src/Symfony/Component/Messenger/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CHANGELOG
77
* Add option `redis_sentinel` as an alias for `sentinel_master`
88
* Add `--all` option to the `messenger:consume` command
99
* Add parameter `$jitter` to `MultiplierRetryStrategy` in order to randomize delay and prevent the thundering herd effect
10+
* Add `SIGQUIT` signal among list of signals that gracefully shut down `messenger:consume` and `messenger:failed:retry` commands
1011

1112
7.0
1213
---

src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti
264264

265265
public function getSubscribedSignals(): array
266266
{
267-
return $this->signals ?? (\extension_loaded('pcntl') ? [\SIGTERM, \SIGINT] : []);
267+
return $this->signals ?? (\extension_loaded('pcntl') ? [\SIGTERM, \SIGINT, \SIGQUIT] : []);
268268
}
269269

270270
public function handleSignal(int $signal, int|false $previousExitCode = 0): int|false

src/Symfony/Component/Messenger/Command/FailedMessagesRetryCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function __construct(
5050
private EventDispatcherInterface $eventDispatcher,
5151
private ?LoggerInterface $logger = null,
5252
?PhpSerializer $phpSerializer = null,
53-
private ?array $signals = null
53+
private ?array $signals = null,
5454
) {
5555
parent::__construct($globalReceiverName, $failureTransports, $phpSerializer);
5656
}
@@ -132,7 +132,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
132132

133133
public function getSubscribedSignals(): array
134134
{
135-
return $this->signals ?? (\extension_loaded('pcntl') ? [\SIGTERM, \SIGINT] : []);
135+
return $this->signals ?? (\extension_loaded('pcntl') ? [\SIGTERM, \SIGINT, \SIGQUIT] : []);
136136
}
137137

138138
public function handleSignal(int $signal, int|false $previousExitCode = 0): int|false

0 commit comments

Comments
 (0)
0