baerengraben / ioBroker.swiss-weather-api

Adds Free SRG-SSR Weather API to ioBroker
MIT License
14 stars 13 forks source link

Crash on request time out #32

Closed r748 closed 3 years ago

r748 commented 3 years ago

Hi and thanks for this adapter!

I've had the following issue multiple times now: The adapter crashes with

error: swiss-weather-api.0 (14348) uncaught exception: getaddrinfo ENOTFOUND api.srgssr.ch error: swiss-weather-api.0 (14348) Error: getaddrinfo ENOTFOUND api.srgssr.ch at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:66:26) error: swiss-weather-api.0 (14348) Exception-Code: ENOTFOUND: getaddrinfo ENOTFOUND api.srgssr.ch debug: swiss-weather-api.0 (14348) cleaned everything up... info: swiss-weather-api.0 (14348) terminating error: host.XXXXX.local instance system.adapter.swiss-weather-api.0 terminated with code 6 (UNCAUGHT_EXCEPTION)

Then restart ist initiated

info: host.HOMESERVER.local Restart adapter system.adapter.swiss-weather-api.0 because enabled

but then cancelled immediately afterwards

warn: host.XXXXX.local Do not restart adapter system.adapter.swiss-weather-api.0 because restart loop detected

Could you please fix the adapter to handle the encountered exception?

Thanks, Rob

baerengraben commented 3 years ago

Hi Rob

Here ioBroker seems not to be able to do the DNS resolution. This is strange. "api.srgssr.ch" has never been unreachable for me. Does this problem exist permanently or only irregularly?

Otherwise I will catch this exception in a next version.

Greetings Ralph

r748 commented 3 years ago

Hey Ralph

This issue occurs irregularly. As far as I can tell from the logs, it happens mainly during the night, so it might have something to do with my internet reconnecting or so...

I have fixed this temporarily for myself, with a little script which checks system.adapter.swiss-weather-api.0.alive at a regular interval. In case the data point returns false the script restarts the adapter. But in my opinion it would be better if the adapter would catch the exception, so the crash could be avoided in the first place.

Thanks! Rob

baerengraben commented 3 years ago

Hi Rob

But in my opinion it would be better if the adapter would catch the exception, so the crash could be avoided in the first place.

Yes, that's definitely true. I will take that into account in a next release. Thanks for reporting this!

r748 commented 3 years ago

Great, thanks Ralph!!

baerengraben commented 3 years ago

resolved with release 0.9.1