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

[Bug]: Authenticated Kafka Broker won't start #6423

Closed
loicgreffier opened this issue Jan 19, 2023 · 3 comments
Closed

[Bug]: Authenticated Kafka Broker won't start #6423

loicgreffier opened this issue Jan 19, 2023 · 3 comments

Comments

@loicgreffier
Copy link

loicgreffier commented Jan 19, 2023

Module

Kafka

Testcontainers version

1.17.6

Using the latest Testcontainers version?

Yes

Host OS

Windows (WSL2)

Host Arch

x64

Docker version

Client: Docker Engine - Community
 Version:           20.10.17
 API version:       1.41
 Go version:        go1.17.11
 Git commit:        100c701
 Built:             Mon Jun  6 23:02:57 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.17
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.17.11
  Git commit:       a89b842
  Built:            Mon Jun  6 23:01:03 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.6
  GitCommit:        10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
 runc:
  Version:          1.1.2
  GitCommit:        v1.1.2-0-ga916309
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

What happened?

I run a Kafka broker that requires SASL_PLAIN authentication in my integration tests.

After upgrading from testcontainers v1.15.3 to v1.17.6, the broker is not starting anymore.

Relevant log output

java.lang.IllegalStateException: Container.ExecResult(exitCode=1, stdout=, stderr=Error while executing config command with args '--alter --bootstrap-server BROKER://0d1f22e4c31d:9092 --entity-type brokers --entity-name 1 --add-config advertised.listeners=[PLAINTEXT://172.20.86.113:49153,BROKER://0d1f22e4c31d:9092]'
java.util.concurrent.TimeoutException
	at org.apache.kafka.common.internals.KafkaFutureImpl$SingleWaiter.await(KafkaFutureImpl.java:108)
	at org.apache.kafka.common.internals.KafkaFutureImpl.get(KafkaFutureImpl.java:272)
	at kafka.admin.ConfigCommand$.getResourceConfig(ConfigCommand.scala:552)
	at kafka.admin.ConfigCommand$.alterConfig(ConfigCommand.scala:338)
	at kafka.admin.ConfigCommand$.processCommand(ConfigCommand.scala:302)
	at kafka.admin.ConfigCommand$.main(ConfigCommand.scala:97)
	at kafka.admin.ConfigCommand.main(ConfigCommand.scala)
)
	at org.testcontainers.containers.KafkaContainer.containerIsStarted(KafkaContainer.java:119)
	at org.testcontainers.containers.GenericContainer.containerIsStarted(GenericContainer.java:701)
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:521)
	at org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:344)
	at org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
	at org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:334)
	at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:322)
	at com.michelin.ns4kafka.integration.AbstractIntegrationTest.getProperties(AbstractIntegrationTest.java:54)
	at io.micronaut.test.extensions.junit5.MicronautJunit5Extension.resolveTestProperties(MicronautJunit5Extension.java:279)
	at io.micronaut.test.extensions.junit5.MicronautJunit5Extension.resolveTestProperties(MicronautJunit5Extension.java:77)
	at io.micronaut.test.extensions.AbstractMicronautExtension.beforeClass(AbstractMicronautExtension.java:289)
	at io.micronaut.test.extensions.junit5.MicronautJunit5Extension.beforeAll(MicronautJunit5Extension.java:84)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$12(ClassBasedTestDescriptor.java:395)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:395)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:211)
	at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:84)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:148)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
	at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
	at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
	at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
	at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:99)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:79)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:75)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
	at jdk.proxy2/jdk.proxy2.$Proxy5.stop(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:193)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:133)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
	at worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)

...

[2023-01-19 19:52:31,465] INFO [RequestSendThread controllerId=1] Controller 1 connected to tc-VmzrNFcM:9092 (id: 1 rack: null) for sending state change requests (kafka.controller.RequestSendThread)
[2023-01-19 19:52:31,493] TRACE [Controller id=1 epoch=1] Received response UpdateMetadataResponseData(errorCode=0) for request UPDATE_METADATA with correlation id 0 sent to broker tc-VmzrNFcM:9092 (id: 1 rack: null) (state.change.logger)
[2023-01-19 19:52:31,524] INFO [broker-1-to-controller-send-thread]: Recorded new controller, from now on will use broker tc-VmzrNFcM:9092 (id: 1 rack: null) (kafka.server.BrokerToControllerRequestThread)
[2023-01-19 19:52:32,209] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:32,617] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:33,022] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:33,427] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:33,832] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:34,238] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:34,642] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:35,046] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:35,449] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:35,851] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:36,254] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:36,328] INFO [Controller id=1] Processing automatic preferred replica leader election (kafka.controller.KafkaController)
[2023-01-19 19:52:36,328] TRACE [Controller id=1] Checking need to trigger auto leader balancing (kafka.controller.KafkaController)
[2023-01-19 19:52:36,658] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:37,061] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:37,464] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:37,867] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:38,270] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:38,673] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:39,076] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:39,479] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:39,882] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:40,285] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:40,688] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:41,091] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:41,494] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:41,896] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:42,299] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:42,702] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:43,105] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:43,508] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:43,911] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:44,314] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:44,716] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:45,118] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:45,520] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:45,923] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:46,327] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:46,730] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:47,133] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)
[2023-01-19 19:52:47,536] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)

...

Container startup failed
org.testcontainers.containers.ContainerLaunchException: Container startup failed
	at app//org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:349)
	at app//org.testcontainers.containers.GenericContainer.start(GenericContainer.java:322)
	at app//com.michelin.ns4kafka.integration.AbstractIntegrationTest.getProperties(AbstractIntegrationTest.java:54)
	at app//io.micronaut.test.extensions.junit5.MicronautJunit5Extension.resolveTestProperties(MicronautJunit5Extension.java:279)
	at app//io.micronaut.test.extensions.junit5.MicronautJunit5Extension.resolveTestProperties(MicronautJunit5Extension.java:77)
	at app//io.micronaut.test.extensions.AbstractMicronautExtension.beforeClass(AbstractMicronautExtension.java:289)
	at app//io.micronaut.test.extensions.junit5.MicronautJunit5Extension.beforeAll(MicronautJunit5Extension.java:84)
	at app//org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$12(ClassBasedTestDescriptor.java:395)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:395)
	at app//org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:211)
	at app//org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:84)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:148)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at java.base@17.0.2/java.util.ArrayList.forEach(ArrayList.java:1511)
	at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
	at app//org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
	at app//org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
	at app//org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
	at app//org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
	at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
	at app//org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
	at app//org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
	at app//org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
	at app//org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
	at app//org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
	at app//org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:99)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:79)
	at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:75)
	at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61)
	at java.base@17.0.2/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base@17.0.2/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base@17.0.2/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base@17.0.2/java.lang.reflect.Method.invoke(Method.java:568)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
	at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
	at jdk.proxy2/jdk.proxy2.$Proxy5.stop(Unknown Source)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker$3.run(TestWorker.java:193)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.executeAndMaintainThreadName(TestWorker.java:129)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:100)
	at org.gradle.api.internal.tasks.testing.worker.TestWorker.execute(TestWorker.java:60)
	at org.gradle.process.internal.worker.child.ActionExecutionWorker.execute(ActionExecutionWorker.java:56)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:133)
	at org.gradle.process.internal.worker.child.SystemApplicationClassLoaderWorker.call(SystemApplicationClassLoaderWorker.java:71)
	at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.run(GradleWorkerMain.java:69)
	at app//worker.org.gradle.process.internal.worker.GradleWorkerMain.main(GradleWorkerMain.java:74)
Caused by: org.rnorth.ducttape.RetryCountExceededException: Retry limit hit with exception
	at app//org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:88)
	at app//org.testcontainers.containers.GenericContainer.doStart(GenericContainer.java:334)
	... 64 more
Caused by: org.testcontainers.containers.ContainerLaunchException: Could not create/start container
	at app//org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:542)
	at app//org.testcontainers.containers.GenericContainer.lambda$doStart$0(GenericContainer.java:344)
	at app//org.rnorth.ducttape.unreliables.Unreliables.retryUntilSuccess(Unreliables.java:81)
	... 65 more
Caused by: java.lang.IllegalStateException: Container.ExecResult(exitCode=1, stdout=, stderr=Error while executing config command with args '--alter --bootstrap-server BROKER://0d1f22e4c31d:9092 --entity-type brokers --entity-name 1 --add-config advertised.listeners=[PLAINTEXT://172.20.86.113:49153,BROKER://0d1f22e4c31d:9092]'
java.util.concurrent.TimeoutException
	at org.apache.kafka.common.internals.KafkaFutureImpl$SingleWaiter.await(KafkaFutureImpl.java:108)
	at org.apache.kafka.common.internals.KafkaFutureImpl.get(KafkaFutureImpl.java:272)
	at kafka.admin.ConfigCommand$.getResourceConfig(ConfigCommand.scala:552)
	at kafka.admin.ConfigCommand$.alterConfig(ConfigCommand.scala:338)
	at kafka.admin.ConfigCommand$.processCommand(ConfigCommand.scala:302)
	at kafka.admin.ConfigCommand$.main(ConfigCommand.scala:97)
	at kafka.admin.ConfigCommand.main(ConfigCommand.scala)
)
	at org.testcontainers.containers.KafkaContainer.containerIsStarted(KafkaContainer.java:119)
	at org.testcontainers.containers.GenericContainer.containerIsStarted(GenericContainer.java:701)
	at org.testcontainers.containers.GenericContainer.tryStart(GenericContainer.java:521)
	... 67 more


AccessControlListTest > initializationError FAILED
    org.testcontainers.containers.ContainerLaunchException at GenericContainer.java:349
        Caused by: org.rnorth.ducttape.RetryCountExceededException at Unreliables.java:88
            Caused by: org.testcontainers.containers.ContainerLaunchException at GenericContainer.java:542
                Caused by: java.lang.IllegalStateException at KafkaContainer.java:119

Additional Information

As you can see, the Kafka broker is failing on :

"[2023-01-19 19:53:27,758] INFO [SocketServer listenerType=ZK_BROKER, nodeId=1] Failed authentication with /172.22.0.2 (Unexpected Kafka request of type METADATA during SASL handshake.) (org.apache.kafka.common.network.Selector)"

I think this is due to the kafka-configs command run in the containerIsStarted method of the KafkaContainer class.

As this command is not authenticated (my broker requires it), it fails and throws an IllegalStateException that prevents the broker from starting.

@ImFlog
Copy link

ImFlog commented Jan 27, 2023

I think I have the same issue, but I don't think this is caused by Testcontainers.
I am building a plugin for multiple version of Kafka and only 1 of those version fails (the code is the same except for the Kafka version) : https://github.com/ImFlog/schema-registry-plugin/actions/runs/4028717990/jobs/6925891503
I am looking if I can find something that would have changed on Confluent images side but without success for now. Maybe we could open an issue on their repository ?

@eddumelendez
Copy link
Member

It would be great if more context is shared, like the kafka client setup. Wonder if #3899 (comment) is related

@eddumelendez eddumelendez added the resolution/waiting-for-info Waiting for more information of the issue author or another 3rd party. label Jul 24, 2023
@eddumelendez
Copy link
Member

I've added some examples using SASL with JAAS. See #7763

@eddumelendez eddumelendez removed the resolution/waiting-for-info Waiting for more information of the issue author or another 3rd party. label Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants