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

Exception in thread "upnp-async-*" java.lang.IllegalArgumentException: Invalid URI host: null (authority: null) #2494

Closed
cebrox opened this issue Sep 24, 2021 · 3 comments · Fixed by #2979
Labels
external bug A problem or unintended behavior of an external library

Comments

@cebrox
Copy link

cebrox commented Sep 24, 2021

Hi,

i'am running openhab 3.1.0 in a docker-container on my RPi 3 with the offical image.

These are my installed Add-Ons:

  • Amazon Echo Control Binding
  • Homematic Binding
  • MQTT Binding
  • Onkyo Binding
  • Samsung TV Binding
  • Shelly Binding
  • Tankerkoenig Binding
  • Telegram Binding
  • UniFi Binding
  • openHAB Cloud Connector
  • InfluxDB Persistence
  • RRD4j Persistence
  • Javascript Transformation
  • JSONPath Transformation
  • Map Transformation
  • BasicUI
  • HABPanel

From time to time i get following error in my logs:

Exception in thread "upnp-async-19" java.lang.IllegalArgumentException: Invalid URI host: null (authority: null)
	at org.eclipse.jetty.client.HttpClient.checkHost(HttpClient.java:521)
	at org.eclipse.jetty.client.HttpClient.newHttpRequest(HttpClient.java:506)
	at org.eclipse.jetty.client.HttpClient.newRequest(HttpClient.java:464)
	at org.jupnp.transport.impl.jetty.JettyStreamClientImpl.createRequest(JettyStreamClientImpl.java:106)
	at org.jupnp.transport.impl.jetty.JettyStreamClientImpl.createRequest(JettyStreamClientImpl.java:1)
	at org.jupnp.transport.spi.AbstractStreamClient.sendRequest(AbstractStreamClient.java:87)
	at org.jupnp.transport.RouterImpl.send(RouterImpl.java:327)
	at org.jupnp.protocol.RetrieveRemoteDescriptors.describeService(RetrieveRemoteDescriptors.java:325)
	at org.jupnp.protocol.RetrieveRemoteDescriptors.describeServices(RetrieveRemoteDescriptors.java:263)
	at org.jupnp.protocol.RetrieveRemoteDescriptors.describe(RetrieveRemoteDescriptors.java:205)
	at org.jupnp.protocol.RetrieveRemoteDescriptors.describe(RetrieveRemoteDescriptors.java:184)
	at org.jupnp.protocol.RetrieveRemoteDescriptors.run(RetrieveRemoteDescriptors.java:104)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

It seem's that all working correctly, but i want to kick that out of my logs 😆

Greetings
Cebrox

@wborn
Copy link
Member

wborn commented Sep 26, 2021

The stacktrace suggests you have some device in your network that communicates an invalid URL which is used by jUPnP to obtain more data. You should create an issue for this in the jUPnP issue tracker to either detect this or to improve the exception handling. Also add some debug logging to your issue (log:set debug org.jupnp) so it can be more easily fixed. The debug logging will probably also show what URL it is trying to connect to.

@wborn wborn added the external bug A problem or unintended behavior of an external library label Sep 26, 2021
@cweitkamp
Copy link
Contributor

I recently found a warning in my logs with a similar cause. It looks like the checkHost(URI uri) method called by newRequest(...) of the org.eclipse.jetty.client.HttpClient throws an IAE when the host of an URI is null. As this is a common way to create HTTP requests and we are using it in some places in OHC and in a lot of add-ons we might thing about hardening our code too.

    /**
     * <p>Checks {@code uri} for the host to be non-null host.</p>
     * <p>URIs built from strings that have an internationalized domain name (IDN)
     * are parsed without errors, but {@code uri.getHost()} returns null.</p>
     *
     * @param uri the URI to check for non-null host
     * @return the same {@code uri} if the host is non-null
     * @throws IllegalArgumentException if the host is null
     */
    private URI checkHost(URI uri)
    {
        ...
2021-11-15 11:50:51.685 [WARN ] [mmon.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception: 
java.lang.IllegalArgumentException: Invalid URI host: null (authority: null)
        at org.eclipse.jetty.client.HttpClient.checkHost(HttpClient.java:521) ~[?:?]
        at org.eclipse.jetty.client.HttpClient.newHttpRequest(HttpClient.java:506) ~[?:?]
        at org.eclipse.jetty.client.HttpClient.newRequest(HttpClient.java:464) ~[?:?]
        at org.eclipse.jetty.client.HttpClient.newRequest(HttpClient.java:453) ~[?:?]
        at org.openhab.core.io.net.http.HttpUtil.executeUrlAndGetReponse(HttpUtil.java:212) ~[?:?]
        at org.openhab.core.io.net.http.HttpUtil.downloadData(HttpUtil.java:439) ~[?:?]
        at org.openhab.core.io.net.http.HttpUtil.downloadImage(HttpUtil.java:402) ~[?:?]
        at org.openhab.core.io.net.http.HttpUtil.downloadImage(HttpUtil.java:373) ~[?:?]
        at org.openhab.core.io.net.http.HttpUtil.downloadImage(HttpUtil.java:359) ~[?:?]
        at org.openhab.binding.chromecast.internal.ChromecastStatusUpdater.downloadImage(ChromecastStatusUpdater.java:262) ~[?:?]
        at org.openhab.binding.chromecast.internal.ChromecastStatusUpdater.downloadImageFromCache(ChromecastStatusUpdater.java:280) ~[?:?]
        at org.openhab.binding.chromecast.internal.ChromecastStatusUpdater.updateImage(ChromecastStatusUpdater.java:255) ~[?:?]
        at org.openhab.binding.chromecast.internal.ChromecastStatusUpdater.updateMetadataStatus(ChromecastStatusUpdater.java:203) ~[?:?]
        at org.openhab.binding.chromecast.internal.ChromecastStatusUpdater.updateMediaInfoStatus(ChromecastStatusUpdater.java:198) ~[?:?]
        at org.openhab.binding.chromecast.internal.ChromecastStatusUpdater.updateMediaStatus(ChromecastStatusUpdater.java:180) ~[?:?]
        at org.openhab.binding.chromecast.internal.ChromecastCommander.handleRefresh(ChromecastCommander.java:115) ~[?:?]
        at org.openhab.binding.chromecast.internal.handler.ChromecastHandler$Coordinator.refresh(ChromecastHandler.java:324) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:?]
        at java.util.concurrent.FutureTask.runAndReset(Unknown Source) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:?]
        at java.lang.Thread.run(Unknown Source) [?:?]

@openhab-bot
Copy link
Collaborator

This issue has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/java-exception-upnp-async-after-upgrade-from-4-0-3-to-4-1-0/152728/2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external bug A problem or unintended behavior of an external library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants