Skip to content
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

NPE when the keystore password is NULL in ReloadableSslContextFactoryProvider #976

Open
findinpath opened this issue Jan 14, 2022 · 0 comments · May be fixed by #977
Open

NPE when the keystore password is NULL in ReloadableSslContextFactoryProvider #976

findinpath opened this issue Jan 14, 2022 · 0 comments · May be fixed by #977

Comments

@findinpath
Copy link
Contributor

While trying to start Trino with the following config.properties

#single node install config
coordinator=true
node-scheduler.include-coordinator=true
discovery.uri=http://localhost:8080

http-server.https.enabled=true
http-server.https.port=8443
http-server.https.keystore.path=/tmp/presto-master.jks
#http-server.https.keystore.key=123456
http-server.http.port=8080
http-server.authentication.allow-insecure-over-http=true

the following exception occurs:

trino-coordinator_1  | 1) [Guice/ErrorInCustomProvider]: NullPointerException
trino-coordinator_1  |   while locating HttpServerProvider
trino-coordinator_1  |   at GeneratedMethodAccessor26.invoke(Unknown Source)
trino-coordinator_1  |   while locating HttpServer
trino-coordinator_1  | 
trino-coordinator_1  | Learn more:
trino-coordinator_1  |   https://github.com/google/guice/wiki/ERROR_IN_CUSTOM_PROVIDER
trino-coordinator_1  | Caused by: NullPointerException
trino-coordinator_1  | 	at ReloadableSslContextFactoryProvider.loadKeyStore(ReloadableSslContextFactoryProvider.java:212)
trino-coordinator_1  | 	at ReloadableSslContextFactoryProvider.loadContextFactory(ReloadableSslContextFactoryProvider.java:107)
trino-coordinator_1  | 	at ReloadableSslContextFactoryProvider.<init>(ReloadableSslContextFactoryProvider.java:99)
trino-coordinator_1  | 	at HttpServer.createReloadingSslContextFactory(HttpServer.java:534)
trino-coordinator_1  | 	at HttpServer.lambda$new$0(HttpServer.java:231)
trino-coordinator_1  | 	at java.base/Optional.orElseGet(Optional.java:369)
trino-coordinator_1  | 	at HttpServer.<init>(HttpServer.java:231)
trino-coordinator_1  | 	at HttpServerProvider.get(HttpServerProvider.java:149)
trino-coordinator_1  | 	at HttpServerProvider.get(HttpServerProvider.java:46)
trino-coordinator_1  | 	at ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
trino-coordinator_1  | 	at BoundProviderFactory.provision(BoundProviderFactory.java:72)
trino-coordinator_1  | 	at ProviderInternalFactory$1.call(ProviderInternalFactory.java:67)
trino-coordinator_1  | 	at ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:109)
trino-coordinator_1  | 	at LifeCycleModule.provision(LifeCycleModule.java:54)
trino-coordinator_1  | 	at ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:117)
trino-coordinator_1  | 	at ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:66)
trino-coordinator_1  | 	at ProviderInternalFactory.circularGet(ProviderInternalFactory.java:62)
trino-coordinator_1  | 	at BoundProviderFactory.get(BoundProviderFactory.java:59)
trino-coordinator_1  | 	at ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
trino-coordinator_1  | 	at SingletonScope$1.get(SingletonScope.java:169)
trino-coordinator_1  | 	at InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45)
trino-coordinator_1  | 	at InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:213)
trino-coordinator_1  | 	at InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:186)
trino-coordinator_1  | 	at InternalInjectorCreator.build(InternalInjectorCreator.java:113)
trino-coordinator_1  | 	at Guice.createInjector(Guice.java:87)
trino-coordinator_1  | 	at Bootstrap.initialize(Bootstrap.java:269)
trino-coordinator_1  | 	at Server.doStart(Server.java:117)
trino-coordinator_1  | 	at Server.lambda$start$0(Server.java:78)
trino-coordinator_1  | 	at io.trino.$gen.Trino_368____20220114_063826_1.run(Unknown Source)
trino-coordinator_1  | 	at Server.start(Server.java:78)
trino-coordinator_1  | 	at TrinoServer.main(TrinoServer.java:38)

The exception leads to

https://github.com/airlift/airlift/blob/master/http-server/src/main/java/io/airlift/http/server/ReloadableSslContextFactoryProvider.java#L212

Note that java.security.KeyStore#load(java.io.InputStream, char[]) accepts NULL values for the char[] argument.
So probably working with Optional in this case will work just fine.

@findinpath findinpath linked a pull request Jan 14, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant