Roman Puchkovskiy created IGNITE-17787:
------------------------------------------

             Summary: Fix node failures due to 
java.nio.channels.CancelledKeyException
                 Key: IGNITE-17787
                 URL: https://issues.apache.org/jira/browse/IGNITE-17787
             Project: Ignite
          Issue Type: Bug
          Components: networking
            Reporter: Roman Puchkovskiy
            Assignee: Roman Puchkovskiy
             Fix For: 2.15


In GridNioServer, sessions may be moved between workers to balance the load. 
When a session is moved from worker A, the corresponding SelectionKey is 
cancelled. When a session is moved back, the selector is registered with the 
corresponding channel.

Key cancellation is an async procedure. It gets really executed during 
selection operation (select() or selectNow()). It might happen that a session 
is moved from worker A (key cancellation is requested), then it gets moved back 
to worker A, but the worker did not have a chance to invoke select() (due to 
contention or some other reason). In such a case, we'll try to re-register a 
selector with a channel for which a key is still registered, which will cause a 
CancelledKeyException to be thrown (which may crash the node if a corresponding 
failure handler is used).

We can fix this by invoking selectNow() just after requesting key cancellation. 
This will make sure the cancellation request is actually handled before the 
session lands to another worker.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to