testcontainers / testcontainers/testcontainers-java
[Enhancement]: Reduce exceptions caused by Unreliables.retryUntilTrue
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 1.9k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 9
Description
Module
Core
Proposal
Hi 👋
I've been profiling test pipelines in our in-house projects and noticed on several Spring-Boot related projects that use DockerComposeContainer that a large amount of exceptions is thrown when waiting for the containers to start.

Throwing RuntimeExceptions with the message "Not ready yet" is not really exceptional here - on the contrary. It's rather the norm. I can't imagine this to be super efficient. It would be great if an alternative solution could be implemented that isn't based on exceptions. Or short-term alternative: throwing a dedicate exception with fillInStackTrace overridden to at least avoid the overhead of generating the stacktrace.
class NotReadyYetException extends RuntimeException {
public NotReadyYetException() {
super("Not ready yet");
}
@Override
public synchronized Throwable fillInStackTrace() {
return this;
}
}
Or caching the exception....
Because duct-tape seems to be read only, I hope this is the correct place for this report. Please lead me to the correct place if not. I'm also open to provide the short term solution somewhere if you want me to and you think this is worthwhile.
Let me know what you think.
Cheers,
Christoph
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the Unreliables.retryUntilTrue entry point and its use by DockerComposeContainer when waiting for containers. Compare the current exception-based retry behavior with the proposed non-exception path or stacktrace-free exception, then define and test a measurable reduction in exception overhead without changing readiness behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, docker-compose, java
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100