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

Jun Rao commented on KAFKA-1418:
--------------------------------

We actually do close the broker in each of the test. The issue may be related 
to the following article. Basically, the normal socket close procedure should 
be client.close first, followed by server close. Otherwise, the port may not be 
reusable after the process is gone since it has to wait for the timeout. So, in 
unit tests, we should try to close all clients before shutting down the broker.

http://hea-www.harvard.edu/~fine/Tech/addrinuse.html

> transient unit test failure in ProducerFailureHandlingTest
> ----------------------------------------------------------
>
>                 Key: KAFKA-1418
>                 URL: https://issues.apache.org/jira/browse/KAFKA-1418
>             Project: Kafka
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 0.8.2
>            Reporter: Jun Rao
>            Assignee: Jun Rao
>
> Saw the following transient failure.
> kafka.api.ProducerFailureHandlingTest > testWrongBrokerList PASSED
> kafka.api.ProducerFailureHandlingTest > testNoResponse FAILED
>     kafka.common.KafkaException: Socket server failed to bind to 
> localhost:49013: 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:84)
>         at kafka.utils.TestUtils$.createServer(TestUtils.scala:120)
>         at 
> kafka.api.ProducerFailureHandlingTest.setUp(ProducerFailureHandlingTest.scala:80)
>         Caused by:
>         java.net.BindException: Address already in use
>             at sun.nio.ch.Net.bind(Native Method)
>             at 
> sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:124)
>             at 
> sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:59)
>             at 
> sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:52)
>             at kafka.network.Acceptor.openServerSocket(SocketServer.scala:191)
>             ... 5 more



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to