You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by al...@apache.org on 2020/09/11 10:22:00 UTC
[ignite] 01/02: IGNITE-13361 Fix hang of sending communication
messages - Fixes #8180.
This is an automated email from the ASF dual-hosted git repository.
alexpl pushed a commit to branch ignite-2.9
in repository https://gitbox.apache.org/repos/asf/ignite.git
commit 532fec77dabce38d4c336f5a3a924b468e3494d7
Author: Mikhail Petrov <pm...@gmail.com>
AuthorDate: Tue Sep 8 11:31:09 2020 +0300
IGNITE-13361 Fix hang of sending communication messages - Fixes #8180.
Signed-off-by: Aleksey Plekhanov <pl...@gmail.com>
(cherry picked from commit db3aad1cc2e0be8352c2e5ba3351d4c839e5f38f)
---
.../org/apache/ignite/internal/util/nio/GridNioServer.java | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index 91ddb42..7faeeda 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@ -726,6 +726,8 @@ public class GridNioServer<T> {
ses0.resend(futs);
+ ses0.procWrite.set(true);
+
// Wake up worker.
ses0.offerStateChange((GridNioServer.SessionChangeRequest)fut0);
}
@@ -1087,11 +1089,15 @@ public class GridNioServer<T> {
* Stop polling for write availability if write queue is empty.
*/
private void stopPollingForWrite(SelectionKey key, GridSelectorNioSessionImpl ses) {
- if (ses.writeQueue().isEmpty()) {
+ if (ses.procWrite.get()) {
ses.procWrite.set(false);
- if ((key.interestOps() & SelectionKey.OP_WRITE) != 0)
- key.interestOps(key.interestOps() & (~SelectionKey.OP_WRITE));
+ if (ses.writeQueue().isEmpty()) {
+ if ((key.interestOps() & SelectionKey.OP_WRITE) != 0)
+ key.interestOps(key.interestOps() & (~SelectionKey.OP_WRITE));
+ }
+ else
+ ses.procWrite.set(true);
}
}
@@ -2289,7 +2295,7 @@ public class GridNioServer<T> {
SelectionKey key = ses.key();
if (key.isValid()) {
- if ((key.interestOps() & SelectionKey.OP_WRITE) == 0)
+ if (ses.procWrite.get() && (key.interestOps() & SelectionKey.OP_WRITE) == 0)
key.interestOps(key.interestOps() | SelectionKey.OP_WRITE);
// Update timestamp to protected against false write timeout.