Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimone Bordet2014-01-13 14:25:55 +0000
committerSimone Bordet2014-01-13 14:25:55 +0000
commit86b9e72f2267aebdbee226f61c0e9bfa3982e81d (patch)
tree35de93f653247b1e644412dfdfa396d505b8aa63
parentbb951aeb8bbe0bbfb6bec1a2540505ad5b76a6f4 (diff)
downloadorg.eclipse.jetty.project-86b9e72f2267aebdbee226f61c0e9bfa3982e81d.tar.gz
org.eclipse.jetty.project-86b9e72f2267aebdbee226f61c0e9bfa3982e81d.tar.xz
org.eclipse.jetty.project-86b9e72f2267aebdbee226f61c0e9bfa3982e81d.zip
425551 - Memory Leak in SelectConnector$ConnectTimeout.expired.
Removing the channel from the _connectingChannels map, and closing the channel in case the connect is not successful.
-rw-r--r--jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java24
-rw-r--r--jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java1
2 files changed, 16 insertions, 9 deletions
diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java
index 5b83076c2f..48842216c6 100644
--- a/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java
+++ b/jetty-client/src/main/java/org/eclipse/jetty/client/SelectConnector.java
@@ -226,18 +226,24 @@ class SelectConnector extends AggregateLifeCycle implements HttpClient.Connector
if (channel.isConnectionPending())
{
LOG.debug("Channel {} timed out while connecting, closing it", channel);
- try
- {
- // This will unregister the channel from the selector
- channel.close();
- }
- catch (IOException x)
- {
- LOG.ignore(x);
- }
+ close();
+ _connectingChannels.remove(channel);
destination.onConnectionFailed(new SocketTimeoutException());
}
}
+
+ private void close()
+ {
+ try
+ {
+ // This will unregister the channel from the selector
+ channel.close();
+ }
+ catch (IOException x)
+ {
+ LOG.ignore(x);
+ }
+ }
}
public static class UpgradableEndPoint implements AsyncEndPoint
diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java
index 7eb0d520ac..538fbfa1a9 100644
--- a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java
+++ b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectorManager.java
@@ -643,6 +643,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
else
{
key.cancel();
+ channel.close();
}
}
}

Back to the top