openhab / openhab-android

openHAB client for Android
https://play.google.com/store/apps/details?id=org.openhab.habdroid
Eclipse Public License 2.0
590 stars 317 forks source link

Timeout when openhab-cloud is used for notifications only #898

Closed mueller-ma closed 3 years ago

mueller-ma commented 6 years ago

Actual behaviour

The app should show "openHAB cloud is not configured for remote access" or similar.

Expected behaviour

The app loads for a long time until a timeout occurs.

Steps to reproduce

  1. Paper UI => Configuration => Services => openHAB Cloud => Mode => Notifications
  2. Don't configure a local url in the app
  3. Configure the remote connection
  4. Go back to MainActivity

Can you reproduce the issue in demo mode?

No.

Environment data

Client

Server

openHAB Cloud

Logs

App log

05-23 17:32:56.719 19527-19527/org.openhab.habdroid D/OpenHABMainActivity: onResume()
05-23 17:32:56.720 19527-19558/org.openhab.habdroid V/FA: Connection attempt already in progress
05-23 17:32:56.721 19527-19527/org.openhab.habdroid D/ContentController: Update to connection null (message null)
05-23 17:32:56.721 19527-19527/org.openhab.habdroid D/PageConnectionHolderFragment: updateActiveConnections: URL list [], connection null
05-23 17:32:56.723 19527-19558/org.openhab.habdroid V/FA: Activity resumed, time: 255687750
05-23 17:32:56.725 19527-19558/org.openhab.habdroid I/FA: Tag Manager is not found and thus will not be used
05-23 17:32:56.731 19527-19558/org.openhab.habdroid D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=OpenHABMainActivity, firebase_screen_id(_si)=-[...]]
05-23 17:32:56.737 19527-19527/org.openhab.habdroid V/NFC: this device does not have NFC support
05-23 17:32:56.754 19527-19558/org.openhab.habdroid V/FA: Connection attempt already in progress
05-23 17:32:56.765 19527-19527/org.openhab.habdroid D/ContentController: Update to connection org.openhab.habdroid.core.connection.DefaultConnection@655544f8 (message null)
05-23 17:32:56.765 19527-19527/org.openhab.habdroid D/PageConnectionHolderFragment: updateActiveConnections: URL list [], connection org.openhab.habdroid.core.connection.DefaultConnection@655544f8
05-23 17:32:56.800 19527-19575/org.openhab.habdroid I/OpenGLRenderer: Initialized EGL, version 1.4
05-23 17:32:56.801 19527-19575/org.openhab.habdroid D/OpenGLRenderer: Swap behavior 1
05-23 17:32:56.803 19527-19575/org.openhab.habdroid W/Adreno-ES20: <get_gpu_clk:229>: open failed: errno 13
05-23 17:32:56.836 19527-19576/org.openhab.habdroid D/MemorizingTrustManager: checkCertTrusted([Lcom.android.org.conscrypt.OpenSSLX509Certificate;@760700f, ECDHE_RSA, true)
05-23 17:32:56.837 19527-19576/org.openhab.habdroid D/MemorizingTrustManager: checkCertTrusted: trying appTrustManager
05-23 17:32:56.841 19527-19576/org.openhab.habdroid D/MemorizingTrustManager: checkCertTrusted: trying defaultTrustManager
05-23 17:32:56.861 19527-19578/org.openhab.habdroid D/GcmRegistrationService: Register device at openHAB-cloud with URL: addAndroidRegistration?deviceId=[...]
05-23 17:32:56.868 19527-19527/org.openhab.habdroid W/art: Before Android 4.1, method int android.support.v7.widget.DropDownListView.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
05-23 17:32:56.909 19527-19558/org.openhab.habdroid D/FA: Connected to remote service
05-23 17:32:56.909 19527-19558/org.openhab.habdroid V/FA: Processing queued up service tasks: 4
05-23 17:32:57.066 19527-19578/org.openhab.habdroid D/GcmRegistrationService: GCM reg id success
05-23 17:33:01.996 19527-19558/org.openhab.habdroid V/FA: Inactivity, disconnecting from the service
05-23 17:33:27.122 19527-19527/org.openhab.habdroid E/OpenHABMainActivity: Error: java.net.SocketTimeoutException: timeout
    HTTP status code: 0
05-23 17:33:27.122 19527-19527/org.openhab.habdroid D/ContentController: Indicate server failure (message Connection to host failed)
05-23 17:33:51.713 19527-20135/org.openhab.habdroid V/FA: Recording user engagement, ms: 54986
05-23 17:33:51.719 19527-20135/org.openhab.habdroid V/FA: Connecting to remote service
05-23 17:33:51.728 19527-20135/org.openhab.habdroid V/FA: Activity paused, time: 255742735

openHAB Server log

Nothing interesting here

Reverse Proxy log

Don't have them
Don't have them
maniac103 commented 6 years ago

AFAICT the timeout is inevitable (server side thing), so this issue is about reporting SocketTimeoutExceptions differently if they're for a remote connection?

(Ideally the server call would report error instead of timing out)

mueller-ma commented 6 years ago

I already thought this is a server side issue and opened this issue as a reference for an openhab-cloud issue (https://github.com/openhab/openhab-cloud/issues/199)

maniac103 commented 6 years ago

It's an issue with the cloud connector in the server itself (the component that's loaded into the server and talks to openhab-cloud) ... that's probably more suited for openhab2-addons?