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

Problem with ctrl+C signal (does not stop the command) #7783

Closed
Wirone opened this issue Jan 26, 2024 · 4 comments
Closed

Problem with ctrl+C signal (does not stop the command) #7783

Wirone opened this issue Jan 26, 2024 · 4 comments
Labels
kind/bug topic/docker Docker distribution, development runtime topic/I/O

Comments

@Wirone
Copy link
Member

Wirone commented Jan 26, 2024

We currently have problem with ctrl+C signal (does not stop the command when run in Docker). The fix / check commands must stop gracefully when SIGTERM is invoked.

$ docker run --rm -it -v $(pwd):/code ghcr.io/php-cs-fixer/php-cs-fixer:3-php8.3 check

and then ctrl+C should stop the command.

Originally posted by @Wirone in #7782 (comment)

@Wirone
Copy link
Member Author

Wirone commented Jan 26, 2024

It looks like it moving pcntl to the lower layer and including it in the Docker image does not solve the problem anyway, but running Docker container with --init makes ctrl+C work properly 🤔.

The change in #7782 is correct anyway, because symfony/console requires pcntl to work with signals.

@Wirone
Copy link
Member Author

Wirone commented Jan 26, 2024

@hgiesenow do you know what can be the root cause of Fixer not reacting to ctrl+C when running with docker run? When I run Fixer inside container and use ctrl+C inside the container, the Fixer's process stops properly.

$ docker run --rm -it --init -v $(pwd):/code --entrypoint="" fixer:local sh
/code # php-cs-fixer check
PHP CS Fixer 3.48.1-DEV Small Changes by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.2
Loaded config default from "/code/.php-cs-fixer.php".
    0/1070 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░]   0%^C
/code #

fixer:local image used above is a local build (docker build --target dist -t fixer:local .) on branch with correct pcntl.

This comment was marked as outdated.

@Wirone
Copy link
Member Author

Wirone commented May 17, 2024

While working on #8021 I've just tested and ctrl+C works properly:

$ docker run -it --rm -v $(pwd):/code ghcr.io/php-cs-fixer/php-cs-fixer:3.57-php8.3 check

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
PHP CS Fixer 3.57.1 7th Gear by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.7
Running analysis on 7 cores with 10 files per process.
Parallel runner is an experimental feature and may be unstable, use it at your own risk. Feedback highly appreciated!
Loaded config default from "/code/.php-cs-fixer.php".
Using cache file "/code/.php-cs-fixer.cache.json".
  336/1118 [▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░]  30%^C
Found 0 of 1118 files that can be fixed in 3.379 seconds, 16.000 MB memory used

It wasn't working without -it though:

$ docker run -v $(pwd):/code ghcr.io/php-cs-fixer/php-cs-fixer:3.57-php8.3 check

Status: Downloaded newer image for ghcr.io/php-cs-fixer/php-cs-fixer:3.57-php8.3
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
PHP CS Fixer 3.57.1 7th Gear by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.7
Running analysis on 1 core sequentially.
You can enable parallel runner and speed up the analysis! Please see https://cs.symfony.com/doc/usage.html for more information.
Loaded config default from "/code/.php-cs-fixer.php".
Using cache file "/code/.php-cs-fixer.cache.json".
    0/1118 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░]   0%
   14/1118 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░]   1%
   36/1118 [░░░░░░░░░░░░░░░░░░░░░░░░░░░░]   3%
   56/1118 [▓░░░░░░░░░░░░░░░░░░░░░░░░░░░]   5%
   70/1118 [▓░░░░░░░░░░░░░░░░░░░░░░░░░░░]   6%
   82/1118 [▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░]   7%
   92/1118 [▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░]   8%
  112/1118 [▓▓░░░░░░░░░░░░░░░░░░░░░░░░░░]  10%
  135/1118 [▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░]  12%
  154/1118 [▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░░]  13%
  172/1118 [▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░]  15%^C
  193/1118 [▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░░]  17%^C^C^C
  201/1118 [▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░]  17%^C^C^C^C
  224/1118 [▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░░]  20%
  244/1118 [▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░]  21%
  259/1118 [▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░]  23%
  278/1118 [▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░░]  24%
  291/1118 [▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░]  26%
  313/1118 [▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░░]  27%
  328/1118 [▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░]  29%
  336/1118 [▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░░]  30%
  381/1118 [▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░░]  34%
  413/1118 [▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░░]  36%
  443/1118 [▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░]  39%
  448/1118 [▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░]  40%
  452/1118 [▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░]  40%
  464/1118 [▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░]  41%
  478/1118 [▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░░]  42%
  498/1118 [▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░░]  44%^C^C
  524/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░]  46%^C^C
  534/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░]  47%
  548/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░░]  49%
  559/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░]  50%
  591/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░░]  52%
  605/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░]  54%
  620/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░]  55%
  629/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░]  56%
  635/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░░]  56%
  652/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░]  58%
  669/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░]  59%
  671/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░░]  60%
  691/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░]  61%
  707/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░░]  63%
  721/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░]  64%
  732/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░]  65%
  748/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░]  66%
  756/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░░]  67%
  771/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░]  68%
  783/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░]  70%
  795/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░░]  71%
  807/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░]  72%
  813/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░]  72%
  822/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░]  73%
  838/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░░]  74%
  848/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░]  75%
  861/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░░]  77%
  880/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░]  78%
  894/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░░]  79%
  956/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░░]  85%
  979/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░░]  87%
 1004/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░]  89%
 1007/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░]  90%
 1011/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░]  90%
 1035/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░░]  92%
 1063/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░░]  95%
 1094/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░]  97%
 1108/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓░]  99%
 1118/1118 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%


Found 0 of 1118 files that can be fixed in 69.354 seconds, 26.000 MB memory used

I'll close this, we can reopen later if needed.

@Wirone Wirone closed this as completed May 17, 2024
@Wirone Wirone added the topic/docker Docker distribution, development runtime label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug topic/docker Docker distribution, development runtime topic/I/O
Projects
None yet
Development

No branches or pull requests

1 participant