Issue #2796 - Max local stream count exceeded when request fails.
Updates after review. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
ec2b5b1810
commit
907e7afc76
|
@ -763,6 +763,7 @@ public abstract class HTTP2Session extends ContainerLifeCycle implements ISessio
|
||||||
int localCount = localStreamCount.get();
|
int localCount = localStreamCount.get();
|
||||||
int maxCount = getMaxLocalStreams();
|
int maxCount = getMaxLocalStreams();
|
||||||
if (maxCount >= 0 && localCount >= maxCount)
|
if (maxCount >= 0 && localCount >= maxCount)
|
||||||
|
// TODO: remove the dump() in the exception message.
|
||||||
throw new IllegalStateException("Max local stream count " + maxCount + " exceeded" + System.lineSeparator() + dump());
|
throw new IllegalStateException("Max local stream count " + maxCount + " exceeded" + System.lineSeparator() + dump());
|
||||||
if (localStreamCount.compareAndSet(localCount, localCount + 1))
|
if (localStreamCount.compareAndSet(localCount, localCount + 1))
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.eclipse.jetty.client.HttpReceiver;
|
||||||
import org.eclipse.jetty.client.HttpSender;
|
import org.eclipse.jetty.client.HttpSender;
|
||||||
import org.eclipse.jetty.client.api.Result;
|
import org.eclipse.jetty.client.api.Result;
|
||||||
import org.eclipse.jetty.http2.ErrorCode;
|
import org.eclipse.jetty.http2.ErrorCode;
|
||||||
|
import org.eclipse.jetty.http2.IStream;
|
||||||
import org.eclipse.jetty.http2.api.Session;
|
import org.eclipse.jetty.http2.api.Session;
|
||||||
import org.eclipse.jetty.http2.api.Stream;
|
import org.eclipse.jetty.http2.api.Stream;
|
||||||
import org.eclipse.jetty.http2.frames.ResetFrame;
|
import org.eclipse.jetty.http2.frames.ResetFrame;
|
||||||
|
@ -101,7 +102,7 @@ public class HttpChannelOverHTTP2 extends HttpChannel
|
||||||
connection.release(this);
|
connection.release(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onStreamClosed(Stream stream)
|
void onStreamClosed(IStream stream)
|
||||||
{
|
{
|
||||||
connection.onStreamClosed(stream, this);
|
connection.onStreamClosed(stream, this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,8 @@ import org.eclipse.jetty.client.HttpRequest;
|
||||||
import org.eclipse.jetty.client.SendFailure;
|
import org.eclipse.jetty.client.SendFailure;
|
||||||
import org.eclipse.jetty.http.HttpVersion;
|
import org.eclipse.jetty.http.HttpVersion;
|
||||||
import org.eclipse.jetty.http2.ErrorCode;
|
import org.eclipse.jetty.http2.ErrorCode;
|
||||||
|
import org.eclipse.jetty.http2.IStream;
|
||||||
import org.eclipse.jetty.http2.api.Session;
|
import org.eclipse.jetty.http2.api.Session;
|
||||||
import org.eclipse.jetty.http2.api.Stream;
|
|
||||||
import org.eclipse.jetty.util.Callback;
|
import org.eclipse.jetty.util.Callback;
|
||||||
import org.eclipse.jetty.util.log.Log;
|
import org.eclipse.jetty.util.log.Log;
|
||||||
import org.eclipse.jetty.util.log.Logger;
|
import org.eclipse.jetty.util.log.Logger;
|
||||||
|
@ -94,7 +94,6 @@ public class HttpConnectionOverHTTP2 extends HttpConnection implements Sweeper.S
|
||||||
{
|
{
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("Released {}", channel);
|
LOG.debug("Released {}", channel);
|
||||||
// Only non-push channels are released.
|
|
||||||
if (activeChannels.remove(channel))
|
if (activeChannels.remove(channel))
|
||||||
{
|
{
|
||||||
// Recycle only non-failed channels.
|
// Recycle only non-failed channels.
|
||||||
|
@ -109,12 +108,14 @@ public class HttpConnectionOverHTTP2 extends HttpConnection implements Sweeper.S
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void onStreamClosed(Stream stream, HttpChannelOverHTTP2 channel)
|
void onStreamClosed(IStream stream, HttpChannelOverHTTP2 channel)
|
||||||
{
|
{
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("{} closed for {}", stream, channel);
|
LOG.debug("{} closed for {}", stream, channel);
|
||||||
channel.setStream(null);
|
channel.setStream(null);
|
||||||
getHttpDestination().release(this);
|
// Only non-push channels are released.
|
||||||
|
if (stream.isLocal())
|
||||||
|
getHttpDestination().release(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -38,6 +38,7 @@ import org.eclipse.jetty.http.HttpFields;
|
||||||
import org.eclipse.jetty.http.HttpStatus;
|
import org.eclipse.jetty.http.HttpStatus;
|
||||||
import org.eclipse.jetty.http.MetaData;
|
import org.eclipse.jetty.http.MetaData;
|
||||||
import org.eclipse.jetty.http2.ErrorCode;
|
import org.eclipse.jetty.http2.ErrorCode;
|
||||||
|
import org.eclipse.jetty.http2.IStream;
|
||||||
import org.eclipse.jetty.http2.api.Stream;
|
import org.eclipse.jetty.http2.api.Stream;
|
||||||
import org.eclipse.jetty.http2.frames.DataFrame;
|
import org.eclipse.jetty.http2.frames.DataFrame;
|
||||||
import org.eclipse.jetty.http2.frames.HeadersFrame;
|
import org.eclipse.jetty.http2.frames.HeadersFrame;
|
||||||
|
@ -187,7 +188,7 @@ public class HttpReceiverOverHTTP2 extends HttpReceiver implements Stream.Listen
|
||||||
@Override
|
@Override
|
||||||
public void onClosed(Stream stream)
|
public void onClosed(Stream stream)
|
||||||
{
|
{
|
||||||
getHttpChannel().onStreamClosed(stream);
|
getHttpChannel().onStreamClosed((IStream)stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void notifyContent(HttpExchange exchange, DataFrame frame, Callback callback)
|
private void notifyContent(HttpExchange exchange, DataFrame frame, Callback callback)
|
||||||
|
|
Loading…
Reference in New Issue