-
Notifications
You must be signed in to change notification settings - Fork 21
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
port conflict with random zookeeper ports #98
Comments
Haven't run into this issue yet. Out of curiosity: What are the specs of your system? Proper port management for the ZooKeeper testing server is a concern of the library that Kafka for JUnit uses. We're getting rid of it, once Kafka ships with a production-ready KRaft implementation that works out-of-the-box. Kafka for JUnit is -in its current latest - tied to Apache Kafka 3.4.x, which comes with an early-access KRaft implementation. Hence, there's still the necessity for ZK. The earliest version that I'd feel comfortable with is 3.5.x, which ships with a production-ready opt-in for KRaft. The easiest migration path for this library would be to wait for Apache Kafka 4.0.0, which will drop ZK entirely and enable KRaft out-of-the-box. However, I'll check if an opt-in for the next Kafka for JUnit version - which will target Apache Kafka 3.5.x - is feasible. |
It's a MacBookPro circa 2019 running Ventura 13.5.2, 32 GB RAM.
Most of those ports don't show as currently in use, so I assume there were transient and no longer in use. |
I would really appreciate a KRaft config with 3.5 if you can do it. Thank you. |
I took a look at it, but it is too much of a hassle to introduce an alternative provisioning mechanism, especially with the prospect of ZooKeeper being removed altogether in the very near future. Kafka for JUnit will remove ZK as soon as Kafka ships without it. |
getUniqueEphemeralPorts doesn't check whether the ports are free or in use. To avoid a port that is in use call new ServerSocket(0) that finds a random ephemeral port that is free. Fixes mguenther#98
org.testcontainers.containers.KafkaContainer supports KRaft mode (and kafka-native). |
About 1 out of every 50 test runs on my MacOS dev machine I get a port conflict on the randomly assigned zookeeper ports.
Would it be possible to validate that these ports are open before trying? Or catch and retry with different ports?
Or perhaps since zookeeper is not strictly needed with kafka 3.4 is it possible to use a config that does not use zookeeper?
I am currently doing
and getting
The text was updated successfully, but these errors were encountered: