vickychijwani / quill

:ghost: [MOVED TO https://github.com/TryGhost/Ghost-Android] The beautiful Android app for your Ghost blog.
MIT License
553 stars 84 forks source link

Nginx HTTP/2 server: REFUSED_STREAM error #156

Closed vickychijwani closed 7 years ago

vickychijwani commented 7 years ago

A user on Google Play reported they were unable to login. The most likely cause seems to be that Nginx < 1.10.2 does not implement HTTP/2 correctly (see stacktrace below). However OkHttp promises to recover gracefully from errors, so they've added recovery code for this in v3.3.0.

This is clearly an Nginx bug, but we should pull in OkHttp 3.x anyway - that will ease the move to Retrofit 2 later. OkHttp 3 can work with Retrofit 1.x through this tiny adapter library.


Stacktrace:

02-02 03:22:29.268 4955-4955/me.vickychijwani.spectre.debug E/LoginActivity: retrofit.RetrofitError: stream was reset: REFUSED_STREAM
                                                                                 at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:395)
                                                                                 at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
                                                                                 at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
                                                                                 at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
                                                                                 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                                 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                                 at retrofit.Platform$Android$2$1.run(Platform.java:142)
                                                                                 at java.lang.Thread.run(Thread.java:818)
                                                                              Caused by: java.io.IOException: stream was reset: REFUSED_STREAM
                                                                                 at com.squareup.okhttp.internal.framed.FramedStream.getResponseHeaders(FramedStream.java:146)
                                                                                 at com.squareup.okhttp.internal.http.Http2xStream.readResponseHeaders(Http2xStream.java:150)
                                                                                 at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:737)
                                                                                 at com.squareup.okhttp.internal.http.HttpEngine.access$200(HttpEngine.java:87)
                                                                                 at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:722)
                                                                                 at com.facebook.stetho.okhttp.StethoInterceptor.intercept(StethoInterceptor.java:67)
                                                                                 at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:695)
                                                                                 at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:576)
                                                                                 at com.squareup.okhttp.Call.getResponse(Call.java:287)
                                                                                 at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:243)
                                                                                 at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:205)
                                                                                 at com.squareup.okhttp.Call.execute(Call.java:80)
                                                                                 at retrofit.client.OkClient.execute(OkClient.java:53)
                                                                                 at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:326)
                                                                                 at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220) 
                                                                                 at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278) 
                                                                                 at retrofit.CallbackRunnable.run(CallbackRunnable.java:42) 
                                                                                 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) 
                                                                                 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) 
                                                                                 at retrofit.Platform$Android$2$1.run(Platform.java:142) 
                                                                                 at java.lang.Thread.run(Thread.java:818)
eddiezane commented 7 years ago

I actually just solved this today myself but upgrading from Nginx 1.10.0 (from a standard Ubuntu 16.04 install) Nginx to 1.11.9 using https://launchpad.net/~chris-lea/+archive/ubuntu/nginx-devel.

Have been trying to get Quill working for some time now and finally decided to dive in tonight. Glad to see someone beat me to it and already reported the issue.

vickychijwani commented 7 years ago

@eddiezane upgrading to 1.10.2 should fix this too (as per the last comment on the ticket) - did it not work for you? I'm not sure how stable the 1.11.x branch is.

EDIT: Nevermind, I see now that the latest available version of Nginx on Ubuntu 16.04 is 1.10.0 (https://launchpad.net/ubuntu/xenial/+source/nginx)