You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2025/09/26 16:30:48 UTC

(httpcomponents-core) branch master updated (2fbc32a33 -> 4d705d2f0)

This is an automated email from the ASF dual-hosted git repository.

olegk pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git


    from 2fbc32a33 Bug fix: async i/o sessions to not enqueue commands if the underlying channel has been closed
     new 576f3c314 Bug fix: corrected handling of failed protocol upgrade of async i/o data channels
     new 4d705d2f0 Bug fix: I/O reactors to close out active i/o channels in case of abnormal termination

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/apache/hc/core5/reactor/InternalConnectChannel.java   |  3 ++-
 .../java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java | 11 +++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)


(httpcomponents-core) 01/02: Bug fix: corrected handling of failed protocol upgrade of async i/o data channels

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git

commit 576f3c31445585020b734596829efa43d8014897
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Fri Sep 26 16:23:13 2025 +0200

    Bug fix: corrected handling of failed protocol upgrade of async i/o data channels
---
 .../main/java/org/apache/hc/core5/reactor/InternalConnectChannel.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnectChannel.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnectChannel.java
index 92c8b2a23..a69ca198a 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnectChannel.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/InternalConnectChannel.java
@@ -72,15 +72,16 @@ void onIOEvent(final int readyOps) throws IOException {
             //check out connectTimeout
             final long now = System.currentTimeMillis();
             if (checkTimeout(now)) {
-                key.attach(dataChannel);
                 if (reactorConfig.getSocksProxyAddress() == null) {
                     dataChannel.upgrade(eventHandlerFactory.createHandler(dataChannel, sessionRequest.attachment));
+                    key.attach(dataChannel);
                     sessionRequest.completed(dataChannel);
                     dataChannel.handleIOEvent(SelectionKey.OP_CONNECT);
                 } else {
                     final IOEventHandler ioEventHandler = new SocksProxyProtocolHandler(
                             dataChannel, sessionRequest, eventHandlerFactory, reactorConfig);
                     dataChannel.upgrade(ioEventHandler);
+                    key.attach(dataChannel);
                     ioEventHandler.connected(dataChannel);
                 }
             }


(httpcomponents-core) 02/02: Bug fix: I/O reactors to close out active i/o channels in case of abnormal termination

Posted by ol...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

olegk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/httpcomponents-core.git

commit 4d705d2f05e63b9f5a993cb94e62bcb7774f1d25
Author: Oleg Kalnichevski <ol...@apache.org>
AuthorDate: Fri Sep 26 16:23:57 2025 +0200

    Bug fix: I/O reactors to close out active i/o channels in case of abnormal termination
---
 .../java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java
index b5b156ea2..2d7004b77 100644
--- a/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java
+++ b/httpcore5/src/main/java/org/apache/hc/core5/reactor/SingleCoreIOReactor.java
@@ -114,6 +114,7 @@ void enqueueChannel(final ChannelEntry entry) throws IOReactorShutdownException
     void doTerminate() {
         closePendingChannels();
         closePendingConnectionRequests();
+        closeOpenChannels();
         processClosedSessions();
     }
 
@@ -412,6 +413,16 @@ private void processConnectionRequest(final SocketChannel socketChannel, final I
         }
     }
 
+    private void closeOpenChannels() {
+        for (final SelectionKey key : selector.keys()) {
+            final Object attachment = key.attachment();
+            if (attachment instanceof InternalChannel) {
+                final InternalChannel channel = (InternalChannel) attachment;
+                channel.close(CloseMode.IMMEDIATE);
+            }
+        }
+    }
+
     private void closePendingChannels() {
         ChannelEntry entry;
         while ((entry = this.channelQueue.poll()) != null) {