[ https://issues.apache.org/jira/browse/KAFKA-5595?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16089775#comment-16089775 ]
Ismael Juma commented on KAFKA-5595: ------------------------------------ [~rsivaram], thanks for looking deeper into the issue (my suggestion was just a hunch without having looked at the code in detail). One thing that occurred to me over the weekend is that if we close a KafkaChannel, then it doesn't seem possible to throw IllegalStateException since the Send is stored in the KafkaChannel itself (and the IllegalStateException is thrown by KafkaChannel.setSend). Isn't that the case even if the connections are closed because they are idle? In any case, it does seem safer to avoid reusing connection ids. Also, we should probably update Selector.connect to check if the channel id is in `closingChannels` and perhaps throw an exception? > Illegal state in SocketServer; attempt to send with another send in progress > ---------------------------------------------------------------------------- > > Key: KAFKA-5595 > URL: https://issues.apache.org/jira/browse/KAFKA-5595 > Project: Kafka > Issue Type: Bug > Reporter: Jason Gustafson > > I have seen this a couple times, but I'm not sure the conditions associated > with it. > {code} > java.lang.IllegalStateException: Attempt to begin a send operation with prior > send operation still in progress. > at > org.apache.kafka.common.network.KafkaChannel.setSend(KafkaChannel.java:138) > at org.apache.kafka.common.network.Selector.send(Selector.java:248) > at kafka.network.Processor.sendResponse(SocketServer.scala:488) > at kafka.network.Processor.processNewResponses(SocketServer.scala:466) > at kafka.network.Processor.run(SocketServer.scala:431) > at java.lang.Thread.run(Thread.java:748) > {code} > Prior to this event, I see a lot of this message in the logs (always for the > same connection id): > {code} > Attempting to send response via channel for which there is no open > connection, connection id 7 > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)