0

I am trying to figure out why the below close function is being called in netty's(3.10.5) NioWorker. The full Class can be found here

        if (ret < 0 || failure) {
            k.cancel(); // Some JDK implementations run into an infinite loop without this.
            close(channel, succeededFuture(channel));
            return false;
        }

I am thinking there may be a couple of reasons like the host going down or host closing the channel after some time but I was thinking someone else who has worked with NioWorker might know better.

I have two different systems and this code is called a few time per day but the other system has like 100 per day with the same number of traffic. I am trying to find out why this might be the case.

Doctor White
  • 95
  • 14
  • Usually, in the Java networking world, a return value lower than 0 means EOF, this might be a clue for this question – Ferrybig Apr 10 '18 at 07:34

1 Answers1

0

There are 2 conditions for when this function is called:

  • There was an error condition when reading from the channel, this is signalled by the failure variable
  • The channel has reached end of stream, this happens if the other sides closes the channel cleanly (ie, using the TCP FIN flag)
Ferrybig
  • 18,194
  • 6
  • 57
  • 79