-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix missing notifyRemoteAsyncErrors http config wiring #11897
Changes from 6 commits
97f9c1d
3e74543
f10b245
2943577
9fbae2a
c2d4d2a
3663281
6a64240
8b35d6d
d375c8a
0fb278f
ceaa746
dfb2e2b
09ea4e9
ecd9e98
bf492f4
1de023f
efc7170
9229515
2a63ee4
3d2f744
3d2e2fd
c0458a7
a428f3c
bacbabe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,13 +14,15 @@ | |
package org.eclipse.jetty.ee10.test.client.transport; | ||
|
||
import java.io.InputStream; | ||
import java.net.InetSocketAddress; | ||
import java.net.URI; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.security.KeyStore; | ||
import java.util.Collection; | ||
import java.util.EnumSet; | ||
import java.util.List; | ||
import java.util.concurrent.TimeUnit; | ||
import java.util.function.Consumer; | ||
|
||
import jakarta.servlet.http.HttpServlet; | ||
|
@@ -32,7 +34,13 @@ | |
import org.eclipse.jetty.ee10.servlet.ServletHolder; | ||
import org.eclipse.jetty.fcgi.client.transport.HttpClientTransportOverFCGI; | ||
import org.eclipse.jetty.fcgi.server.ServerFCGIConnectionFactory; | ||
import org.eclipse.jetty.http.HostPortHttpField; | ||
import org.eclipse.jetty.http.HttpFields; | ||
import org.eclipse.jetty.http.HttpScheme; | ||
import org.eclipse.jetty.http.HttpVersion; | ||
import org.eclipse.jetty.http.MetaData; | ||
import org.eclipse.jetty.http2.HTTP2Cipher; | ||
import org.eclipse.jetty.http2.api.Session; | ||
import org.eclipse.jetty.http2.client.HTTP2Client; | ||
import org.eclipse.jetty.http2.client.transport.HttpClientTransportOverHTTP2; | ||
import org.eclipse.jetty.http2.server.AbstractHTTP2ServerConnectionFactory; | ||
|
@@ -58,6 +66,7 @@ | |
import org.eclipse.jetty.server.SslConnectionFactory; | ||
import org.eclipse.jetty.toolchain.test.jupiter.WorkDir; | ||
import org.eclipse.jetty.toolchain.test.jupiter.WorkDirExtension; | ||
import org.eclipse.jetty.util.FuturePromise; | ||
import org.eclipse.jetty.util.SocketAddressResolver; | ||
import org.eclipse.jetty.util.component.LifeCycle; | ||
import org.eclipse.jetty.util.ssl.SslContextFactory; | ||
|
@@ -79,6 +88,7 @@ public class AbstractTest | |
protected AbstractConnector connector; | ||
protected ServletContextHandler servletContextHandler; | ||
protected HttpClient client; | ||
protected HTTP2Client http2Client; | ||
|
||
public static Collection<Transport> transports() | ||
{ | ||
|
@@ -189,6 +199,29 @@ protected void startClient(Transport transport, Consumer<HttpClient> consumer) t | |
client.start(); | ||
} | ||
|
||
protected Session newHttp2ClientSession(Session.Listener listener) throws Exception | ||
{ | ||
String host = "localhost"; | ||
int port = ((NetworkConnector)connector).getLocalPort(); | ||
InetSocketAddress address = new InetSocketAddress(host, port); | ||
FuturePromise<Session> promise = new FuturePromise<>(); | ||
http2Client.connect(address, listener, promise); | ||
return promise.get(5, TimeUnit.SECONDS); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, the point of the tests in this module is to run for all transports. This is HTTP/2 specific, so it should be moved to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree this isn't an idea place, but the |
||
|
||
protected MetaData.Request newRequest(String method, HttpFields fields) | ||
{ | ||
return newRequest(method, "/", fields); | ||
} | ||
|
||
protected MetaData.Request newRequest(String method, String path, HttpFields fields) | ||
{ | ||
String host = "localhost"; | ||
int port = ((NetworkConnector)connector).getLocalPort(); | ||
String authority = host + ":" + port; | ||
return new MetaData.Request(method, HttpScheme.HTTP.asString(), new HostPortHttpField(authority), path, HttpVersion.HTTP_2, fields, -1); | ||
} | ||
|
||
public AbstractConnector newConnector(Transport transport, Server server) | ||
{ | ||
return switch (transport) | ||
|
@@ -262,7 +295,7 @@ protected HttpClientTransport newHttpClientTransport(Transport transport) throws | |
ClientConnector clientConnector = new ClientConnector(); | ||
clientConnector.setSelectors(1); | ||
clientConnector.setSslContextFactory(newSslContextFactoryClient()); | ||
HTTP2Client http2Client = new HTTP2Client(clientConnector); | ||
http2Client = new HTTP2Client(clientConnector); | ||
yield new HttpClientTransportOverHTTP2(http2Client); | ||
} | ||
case H3 -> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is the right place to check for
isNotifyRemoteAsyncErrors()
, because not all errors that arrive here are remote async errors.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure there is a way to reliably discriminate errors. Maybe this feature is specific to ee* environments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In Jetty 11, the check for
notifyRemoteAsyncErrors
was done in the HTTP/2 and HTTP/3 layers, not generically.I think we should restore that.
The idea would be to introduce an
onRemoteFailure()
method that is only called from H2 and H3, and have this new method delegate toonFailure()
with an extra parameter, so that pending reads and writes are notified, but listeners are only invoked if the extra parameter is true.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed an attempt at that; two observations: