Closed being23 closed 6 years ago
A ClosedSelectorException
can only happen if the selector has been closed, which in turn only happens when Jetty's ManagedSelector
is stopped, which in turn happens when Jetty's SelectorManager
is stopped, which means that either the client or the server is being stopped.
You don't say if the stack trace happened in host A or B.
Either case, you or something else is stopping Jetty on one node, and that is the cause of your problems.
Hello, I wrote a custom processor for NiFi based on Jetty(Version:9.4.3). Today I found there were thousands of connections to one of the nodes, named after A . I used shell command
ss
to try to find where the connections came from and it showed that most of the connections came from one of the client hosts, similarly, named after B. In host B, I found most of the connections were in state: FIN-WAIT-1, while in host A most of the connections were in state: ESTABLISHED.So I checked the log and found some warnings in the log, like the follwoing:
It showed that the selector chosen for the channel was closed. This might result in the client read/write timeout. My colleague told me if the client experience read/write timeout, connection will be closed and a new connection will be created. Here, I think the operation of closing the connection sent a FIN packet, but it didn't receive ACK packet from Jetty, so the connections were in state FIN-WAIT-1 on the host B. And the new created connection will suffer the same problem. Finally, there will be more and more connections by keeping creating new connections.
My question is why there is a FIN packet, but no ACK packet, is this related to the ClosedSelectorException? And how to solve the problem?
Thanks!