testcontainers / testcontainers/testcontainers-php

Registry tries to cleanup containers whose removal started already

Open
#13 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
215
Forks
34
Avg merge
1h 59m
Merged PRs (30d)
3

Description

I'm faced with the following error message and I was wondering why that is.

This is probably a race condition between the --rm option passed to the container upon creation and the docker rm -f the Registry::remove() method calls. Maybe docker tries to automatically remove the container and Registry::remove() requests the same.

Is there a particular reason why the Registry is needed?

Fatal error: Uncaught Symfony\Component\Process\Exception\ProcessFailedException: The command "'docker' 'rm' '-f' 'testcontainer66959b43958a96.16963867'" failed.

Exit Code: 1(General error)

Working directory: /var/www/html

Output:
================


Error Output:
================
Error response from daemon: removal of container testcontainer66959b43958a96.16963867 is already in progress
 in /var/www/html/vendor/symfony/process/Process.php:270
Stack trace:
#0 /var/www/html/vendor/shyim/testcontainer/src/Container/Container.php(230): Symfony\Component\Process\Process->mustRun()
#1 /var/www/html/vendor/shyim/testcontainer/src/Registry.php(36): Testcontainer\Container\Container->remove()
#2 [internal function]: Testcontainer\Registry::cleanup()
#3 {main}
  thrown in /var/www/html/vendor/symfony/process/Process.php on line 270

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Registry.php cleanup and Container.php around line 230, then reproduce the reported interaction between the --rm option and docker rm -f. Check the Docker and Symfony Process behavior for a removal already in progress. Done means cleanup no longer produces the reported uncaught failure and its expected behavior is documented or covered by a test.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, php, symfony
Domain
devops, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.