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

[iOS and Android] Network request failed when HTTP/2 enabled. #8027

Closed
lucasfeliciano opened this issue Jun 9, 2016 · 4 comments
Closed
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@lucasfeliciano
Copy link
Contributor

lucasfeliciano commented Jun 9, 2016

This was a really interesting issue and really hard to catch.

We started to encounter this error which was crashing the app when doing a post request to the server:

console.log from .catch() of the fetch call.

{ [TypeError: Network request failed]
  line: 25737,
  column: 21,
  sourceURL: 'http://localhost:8081/index.ios.bundle?platform=ios&dev=true' }

XCode console output:

[error] [tid:com.facebook.react.JavaScript] Network request failed
[error] [tid:com.facebook.react.JavaScript] Can't find variable: self
[fatal] [tid:com.facebook.react.RCTExceptionsManagerQueue] Unhandled JS Exception: Network request failed
[fatal][tid:com.facebook.react.RCTExceptionsManagerQueue] Unhandled JS Exception: Can't find variable: self
Communications error: <OS_xpc_error: <error: 0x5a00534> { count = 1, contents = "XPCErrorDescription" => <string: 0x5a00734> { length = 22, contents = "Connection interrupted" } } >

One weird thing is that the first request always throws this error but from the second request everything works fine.

After a long day investigating it we discovered that is related to the HTTP/2 feature

It used to work before, but Chrome deprecated the old way it worked on May 15 and it was de-facto disabled since then.
We've reenabled it by upgrading out openresty which is based on NGINX 1.9.15, but apparently react-native can't handle the upgraded version, which sucks ass.

It will be a pain in the ass to reproduce it since you need OpenSSL 1.0.2, that means the most recent Ubuntu - 16.04, because previous versions are stuck on OpenSSL 1.0.1.

We're running Ubuntu 14.04, so I had to compile OpenSSL from source to make it work.

I saw that on release 0.27 of react-native you guys cherry picked this commit ( 6bbaff2 ) which is related somehow but in the description of the issue ( #4021) that motivated the commit the problem was only for Android however we experienced this in both platforms ( iOS and Android ).

@lucasfeliciano lucasfeliciano changed the title Network request failed when HTTP/2 enabled on iOS and Android [iOS and Android] Network request failed when HTTP/2 enabled. Jun 9, 2016
@ide
Copy link
Contributor

ide commented Jun 9, 2016

On Android there is a known problem with OkHttp and should get better once some upstream issues with OkHttp allow us to use a newer version of OkHttp in RN: #7746.

On iOS I don't think we've seen issues yet but thanks for the report. We should fix the JS bug that causes "Can't find variable: self", but Communications error: <OS_xpc_error> may be out of our control and the best way to get that fixed is to figure out the bug in iOS and open a bug report with Apple.

@xiaoneng
Copy link

Similar #7943

@ryankask
Copy link
Contributor

ryankask commented Jul 28, 2016

Are the servers all using nginx 1.10.X?

This is probably related to https://trac.nginx.org/nginx/ticket/959

I'm experiencing this on iOS and after adding some debugging in the RN networking internals I saw I was getting error -1004. That led me to this: http://stackoverflow.com/questions/36907767/nsurlerrordomain-code-1004-for-few-seconds-after-app-start-up and then to the nginx issue referred to above.

@lacker
Copy link
Contributor

lacker commented Oct 28, 2016

Looks like this has been fixed

@lacker lacker closed this as completed Oct 28, 2016
@facebook facebook locked as resolved and limited conversation to collaborators Jul 19, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

7 participants