testcontainers / testcontainers/testcontainers-java

[Bug]: NullPointerException from ResourceReaper in GenericContainer.stop

Open
#11,492 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type/bug
Dominant language
Java
Stars
8.7k
Forks
1.9k
Avg merge
2d 17h
Merged PRs (30d)
9

Description

Module

Core

Testcontainers version

2.0.3

Using the latest Testcontainers version?

Yes

Host OS

Linux

Host Arch

x86

Docker version
GitHub hosted runners
What happened?
java.lang.NullPointerException: Cannot invoke "Object.hashCode()" because "key" is null
	at java.base/java.util.concurrent.ConcurrentHashMap.replaceNode(ConcurrentHashMap.java:1125)
	at java.base/java.util.concurrent.ConcurrentHashMap.remove(ConcurrentHashMap.java:1116)
	at org.testcontainers.utility.ResourceReaper.stopAndRemoveContainer(ResourceReaper.java:175)
	at org.testcontainers.containers.GenericContainer.stop(GenericContainer.java:652)
	at io.trino.tests.product.launcher.env.DockerContainer.reset(DockerContainer.java:411)
	at io.trino.tests.product.launcher.env.Environment.tryStart(Environment.java:157)

Exact repro steps are unclear.
Based on exceptions logged earlier in the CI run (https://github.com/trinodb/trino/actions/runs/22016571723/job/63619535768?pr=28120) this may be after a failed startup attempt.

Relevant log output

Additional Information

https://github.com/trinodb/trino/actions/runs/22016571723/job/63619535768?pr=28120

Contributor guide

Open the contributing guide

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 ResourceReaper.java at line 175 and GenericContainer.java at line 652, then compare the failed-startup exceptions in the linked Trino CI run. Reproduce the cleanup path after a failed startup and add coverage showing that GenericContainer.stop completes without this NullPointerException.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.