ResourceReaperException: Initialization has been cancelled
See original GitHub issueDescribe the bug It looks like, that in some rare cases .NET Testcontainers can’t connect to Ryuk. I got a few times the following error:
DotNet.Testcontainers.Containers.ResourceReaperException : Initialization has been cancelled.
According the log messages, .NET Testcontainers tries to connect a couple of times. It looks like Ryuk is not ready to accept a connection. @PSanetra Do you have any idea? May this relate to the recent changes in the image?
To Reproduce -
Expected behavior .NET Testcontainers can connect to Ryuk.
Screenshots -
Desktop (please complete the following information):
- Docker Desktop 4.7.1 (77678)
Additional context Build 2193. May relate to: #423, #441, #443.
Workaround
Disable the ResourceReaper (TestcontainersSettings.ResourceReaperEnabled = false).
Issue Analytics
- State:
- Created a year ago
- Comments:57 (14 by maintainers)
Top Results From Across the Web
Application works with docker command but not ...
the problem is that the tests run correctly using the command ... ResourceReaperException : Initialization has been cancelled.
Read more >Waiting for containers to start or be ready
Checks that the container is running and has been running for a defined minimum period of time.
Read more >Resource Reaper
Testcontainers automatically assigns a Resource Reaper session id to each Docker resource. After the tests are finished — whether they are successful or...
Read more >Initialization Strategies With Testcontainers For Integration ...
Learn about several initialization strategies for Testcontainers when writing integration tests: executing commands, mounting files, etc.
Read more >how to properly configure Testcontainers to run PostgreSql ...
I am trying to use Testcontainers dotnet to run postgreSql container for integration testing. I found this code online but I am getting...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It would be also interesting if something like this improves it:
Maybe the container field (value) is not up-to-date, and we return a value that’s obsolete in the meantime. You need to remove the timeout in your test then.
I prefer to find the root cause. The resource reaper must run reliable.
This time the log file looks good. The resource reaper gets the right port (
49156). I double-checked your sources (refactor-async-code) and noticed a few flaws. For instance:Doesn’t make sense. Even if you’re running on Windows, it’s still a Linux container. It should be
Wait.ForUnixContainer().UntilPortIsAvailable(MongoDbPort)instead. Take a look into the MongoDB example in this repository.Maybe you can figure out with
ResourceReaper.GetAndStartNewAsync()why Testcontainers can’t connect to the resource reaper on your machine.Configure the logger and set the level to debug. That should help to identify the issue.