-
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
Cannot invoke "org.eclipse.jetty.io.ManagedSelector.getTotalKeys()" because "selector" is null #9947
Comments
@strogiyotec can you take a look at this? |
I will thanks @minduch could you show me how do you create an embedded jetty instance please |
@strogiyotec please set up a server as described here: Then you can connect with JMC (or a similar JMX console) and try to see if you can reproduce the issue. |
Also, see if |
The test case we have is pretty large, but it should be quite straightforward if you just add a HTTP3 connector to the server. Our log file with Jetty debug logging turned on (with additional output) shows:
Basically our HTTPS connector(s) are created using the following code, where the flags SslContextFactory.Server sslContextFactory=new SslContextFactory.Server();
sslContextFactory.setTrustAll(true);
sslContextFactory.setKeyStore(keyStore);
sslContextFactory.setKeyStorePassword(pw);
sslContextFactory.addExcludeProtocols("TLSv1","TLSv1.1");
sslContextFactory.setRenegotiationAllowed(false);
sslContextFactory.setCipherComparator(HTTP2Cipher.COMPARATOR);
sslContextFactory.setUseCipherSuitesOrder(true);
// Use Conscrypt?
if ( useConscrypt )
sslContextFactory.setProvider("Conscrypt");
// SNI host check is 'false'!
HttpConfiguration https_config=new HttpConfiguration();
SecureRequestCustomizer src=new SecureRequestCustomizer(false);
https_config.addCustomizer(src);
HttpConnectionFactory http=new HttpConnectionFactory(https_config);
ServerConnector httpsConnector;
String http11=http.getProtocol();
if ( useHTTP2 )
{
// HTTP/2 Connection Factories: h2 = HTTP/2, needs ALPN.
HTTP2ServerConnectionFactory h2=new HTTP2ServerConnectionFactory(https_config);
ALPNServerConnectionFactory alpn=new ALPNServerConnectionFactory();
alpn.setDefaultProtocol(http11);
String alpnProtocol=alpn.getProtocol();
SslConnectionFactory tls=new SslConnectionFactory(sslContextFactory,alpnProtocol);
httpsConnector=new ServerConnector(server,tls,alpn,h2,http);
if ( useHTTP3 )
{
// Create the HTTP/3 UDP connector on the selected port "http3Port" (443 for example).
@SuppressWarnings("resource")
HTTP3ServerConnector https3Connector=new HTTP3ServerConnector(server,sslContextFactory,new HTTP3ServerConnectionFactory(https_config));
https3Connector.setPort(http3Port);
// Set bind address if any.
if ( bind!=null )
https3Connector.setHost(bind);
server.addConnector(https3Connector);
}
}
else
{
// Just plain HTTP/1.x using TLS, no ALPN is required...
SslConnectionFactory tls=new SslConnectionFactory(sslContextFactory,http11);
httpsConnector=new ServerConnector(server,tls,http);
}
// Set port (443 for example).
httpsConnector.setPort(port);
// Set bind address if any.
if ( bind!=null )
httpsConnector.setHost(bind); Let me know if you need more pieces of code. If you look carefully in the log output, you will see |
@minduch thanks for the code sample I tried to reproduce it on my end but didn't trigger the error
Just in case the error you encountered means that jetty can't expose the metric over JMX
The |
@strogiyotec I think There should be a If you want to contribute a PR, please do this work in branch |
Will do shortly |
… before calculating #totalKeys
@minduch would be great if you could confirm this issue is fixed for you. You can find nightly builds at https://oss.sonatype.org/content/repositories/jetty-snapshots/. @strogiyotec thanks for the fix! |
@sbordet Is there an easy way to download the latest SNAPSHOT Jars? Our Maven based test case works for some reason with beta2 right now, but our “real product” does not. And to add the nightly build into the product, I need to download most of the Jetty Jars manually, which is very tedious. Is there a ZIP file that contains all of Jetty, much like the one of beta0 (that has not been updated to beta1 or beta2) at Jetty Downloads - The Eclipse Foundation (https://www.eclipse.org/jetty/download.php)? Any idea when beta3 will come out? |
You can download the latest jar from here: https://oss.sonatype.org/content/repositories/jetty-snapshots/org/eclipse/jetty/jetty-io/12.0.0-SNAPSHOT/ Rename it to 12.0.0.beta3 will come out in a few days. |
Sorry for the delay: the issue is gone in Jetty 12.0.0.beta3.
From: Simone Bordet ***@***.***>
Sent: Sunday, June 25, 2023 10:46
To: eclipse/jetty.project ***@***.***>
Cc: Christopher Mindus ***@***.***>; Mention ***@***.***>
Subject: Re: [eclipse/jetty.project] Cannot invoke "org.eclipse.jetty.io.ManagedSelector.getTotalKeys()" because "selector" is null (Issue #9947)
@minduch<https://github.com/minduch> would be great if you could confirm this issue is fixed for you.
You can find nightly builds at https://oss.sonatype.org/content/repositories/jetty-snapshots/.
@strogiyotec<https://github.com/strogiyotec> thanks for the fix!
—
Reply to this email directly, view it on GitHub<#9947 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGXD5VXXV65R2IF37AZPLLDXM73EBANCNFSM6AAAAAAZQGON5Q>.
You are receiving this because you were mentioned.Message ID: ***@***.******@***.***>>
|
Jetty version
Jetty 12 beta2
Java version/vendor
(use: java -version)
openjdk version "17.0.7" 2023-04-18
OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7)
OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode, sharing)
OS type/version
Windows 11 - Microsoft Windows [Version 10.0.22631.1900]
Description
Do not report security issues here! See Jetty Security Reports.
How to reproduce?
Happens everytime we launch our server that embeds Jetty. Previous builds of Jetty 12 did not have this problem, or at least we didn't encounter it.
Also: could someone give me a hint of where to find binary builds of Jetty 12 beta(x), e.g. nightly builds (also perhaps with some kind of indication as to how tests passed or not).
The stack trace:
For some reason, the
selector
variable isnull
during this initialization of the HTTP/3 connector.The text was updated successfully, but these errors were encountered: