[ 
https://issues.apache.org/jira/browse/KAFKA-1501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14128457#comment-14128457
 ] 

Chris Cope commented on KAFKA-1501:
-----------------------------------

[~abhioncbr],
{code}
git clone https://github.com/apache/kafka.git .
./gradlew test
{code}
There will be failures anywhere from 10%-20% of the time. I *think* there is a 
race condition with TestUtils.choosePorts(), where a port is grabbed, closed, 
and then when the KafkaTestHarness uses it, it's not available yet. Looking 
through failures of the last few hundred test runs I've done, there is usually 
one 1 (occasionally 2) ports at fault that then cause subsequent tests to fail 
for the test class. 

Essentially, this race condition is occurring approximately 0.06% of the time a 
socket server is created. However, my team frequently has to rerun tests after 
a code change, because sometimes it fails. This is seen at least multiple times 
a day by us. The best solution seems to catch this exception and then grab new 
ports. Again we're talking about the test harness, so which ports it runs on 
doesn't matter. Thoughts?


> transient unit tests failures due to port already in use
> --------------------------------------------------------
>
>                 Key: KAFKA-1501
>                 URL: https://issues.apache.org/jira/browse/KAFKA-1501
>             Project: Kafka
>          Issue Type: Improvement
>          Components: core
>            Reporter: Jun Rao
>              Labels: newbie
>
> Saw the following transient failures.
> kafka.api.ProducerFailureHandlingTest > testTooLargeRecordWithAckOne FAILED
>     kafka.common.KafkaException: Socket server failed to bind to 
> localhost:59909: Address already in use.
>         at kafka.network.Acceptor.openServerSocket(SocketServer.scala:195)
>         at kafka.network.Acceptor.<init>(SocketServer.scala:141)
>         at kafka.network.SocketServer.startup(SocketServer.scala:68)
>         at kafka.server.KafkaServer.startup(KafkaServer.scala:95)
>         at kafka.utils.TestUtils$.createServer(TestUtils.scala:123)
>         at 
> kafka.api.ProducerFailureHandlingTest.setUp(ProducerFailureHandlingTest.scala:68)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to