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

[expo-gl] Fix crash when debugging remotely #10381

Merged
merged 4 commits into from
Sep 29, 2020

Conversation

sjchmiela
Copy link
Contributor

Why

One of the reasons for #10284.

How

One of the crashes was coming from native:

2020-09-25 14:30:36.831 17563-17563/? A/DEBUG:       #00 pc 00066604  /data/app/~~WpbR_l3nGtiGFWRkbZPEJg==/host.exp.exponent-8fNpD6xuMcBS80u997afBA==/lib/x86/libexpo-gl.so (expo::gl_cpp::EXGLContext::EXGLContext(facebook::jsi::Runtime&, unsigned int)+164) (BuildId: 7e5a0967a575c573c4727065d29b4c52a818e77a)
2020-09-25 14:30:36.831 17563-17563/? A/DEBUG:       #01 pc 000664c0  /data/app/~~WpbR_l3nGtiGFWRkbZPEJg==/host.exp.exponent-8fNpD6xuMcBS80u997afBA==/lib/x86/libexpo-gl.so (expo::gl_cpp::EXGLContext::ContextCreate(facebook::jsi::Runtime&)+384) (BuildId: 7e5a0967a575c573c4727065d29b4c52a818e77a)
2020-09-25 14:30:36.831 17563-17563/? A/DEBUG:       #02 pc 00046e90  /data/app/~~WpbR_l3nGtiGFWRkbZPEJg==/host.exp.exponent-8fNpD6xuMcBS80u997afBA==/lib/x86/libexpo-gl.so (UEXGLContextCreate+32) (BuildId: 7e5a0967a575c573c4727065d29b4c52a818e77a)
2020-09-25 14:30:36.831 17563-17563/? A/DEBUG:       #03 pc 00125860  /data/app/~~WpbR_l3nGtiGFWRkbZPEJg==/host.exp.exponent-8fNpD6xuMcBS80u997afBA==/lib/x86/libexpo-gl.so (Java_expo_modules_gl_cpp_EXGL_EXGLContextCreate+32) (BuildId: 7e5a0967a575c573c4727065d29b4c52a818e77a)

After ensuring expo-gl won't try to create a context for an invalid JS context reference the crash stopped occurring.

Mounting a GLView resulted in an unhandled Promise rejection:

[Unhandled promise rejection: TypeError: Cannot read property '-1' of undefined]
* /Users/sjchmiela/Applications/expo/packages/expo-gl/build/GLView.js:332:15 in getGl
* http://192.168.0.112:19000/__generated__/AppEntry.bundle?platform=android&dev=true&minify=false&hot=false:292922:50 in createContextAsync$
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:45:39 in tryCatch
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:274:21 in invoke
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:97:20 in prototype.method
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:45:39 in tryCatch
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:135:19 in invoke
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:145:12 in PromiseImpl.resolve.then$argument_0
* /Users/sjchmiela/Applications/expo/react-native-lab/react-native/node_modules/promise/setimmediate/core.js:37:11 in tryCallOne
* /Users/sjchmiela/Applications/expo/react-native-lab/react-native/node_modules/promise/setimmediate/core.js:123:14 in setImmediate$argument_0

so I decided to make it more readable. Now it's

[Unhandled promise rejection: Error: GL is currently not available. (Have you enabled remote debugging? GL is not available while debugging remotely.)]
* /Users/sjchmiela/Applications/expo/packages/expo-gl/build/GLView.js:333:9 in getGl
* http://192.168.0.112:19000/__generated__/AppEntry.bundle?platform=android&dev=true&minify=false&hot=false:292922:50 in createContextAsync$
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:45:39 in tryCatch
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:274:21 in invoke
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:97:20 in prototype.method
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:45:39 in tryCatch
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:135:19 in invoke
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:145:12 in PromiseImpl.resolve.then$argument_0
* /Users/sjchmiela/Applications/expo/react-native-lab/react-native/node_modules/promise/setimmediate/core.js:37:11 in tryCallOne
* /Users/sjchmiela/Applications/expo/react-native-lab/react-native/node_modules/promise/setimmediate/core.js:123:14 in setImmediate$argument_0

Test Plan

I have ensured that debugging remotely doesn't crash the application if this is the only reason to do so.

@github-actions
Copy link
Contributor

Native Component List for this branch is ready

@sjchmiela sjchmiela merged commit dd01cd4 into master Sep 29, 2020
@sjchmiela sjchmiela deleted the @sjchmiela/fix-expo-gl-cpp-without-valid-jsrunner branch September 29, 2020 07:12
sjchmiela added a commit that referenced this pull request Sep 29, 2020
One of the reasons for #10284.

One of the crashes was coming from native:
```
2020-09-25 14:30:36.831 17563-17563/? A/DEBUG:       #00 pc 00066604  /data/app/~~WpbR_l3nGtiGFWRkbZPEJg==/host.exp.exponent-8fNpD6xuMcBS80u997afBA==/lib/x86/libexpo-gl.so (expo::gl_cpp::EXGLContext::EXGLContext(facebook::jsi::Runtime&, unsigned int)+164) (BuildId: 7e5a0967a575c573c4727065d29b4c52a818e77a)
2020-09-25 14:30:36.831 17563-17563/? A/DEBUG:       #1 pc 000664c0  /data/app/~~WpbR_l3nGtiGFWRkbZPEJg==/host.exp.exponent-8fNpD6xuMcBS80u997afBA==/lib/x86/libexpo-gl.so (expo::gl_cpp::EXGLContext::ContextCreate(facebook::jsi::Runtime&)+384) (BuildId: 7e5a0967a575c573c4727065d29b4c52a818e77a)
2020-09-25 14:30:36.831 17563-17563/? A/DEBUG:       #2 pc 00046e90  /data/app/~~WpbR_l3nGtiGFWRkbZPEJg==/host.exp.exponent-8fNpD6xuMcBS80u997afBA==/lib/x86/libexpo-gl.so (UEXGLContextCreate+32) (BuildId: 7e5a0967a575c573c4727065d29b4c52a818e77a)
2020-09-25 14:30:36.831 17563-17563/? A/DEBUG:       #3 pc 00125860  /data/app/~~WpbR_l3nGtiGFWRkbZPEJg==/host.exp.exponent-8fNpD6xuMcBS80u997afBA==/lib/x86/libexpo-gl.so (Java_expo_modules_gl_cpp_EXGL_EXGLContextCreate+32) (BuildId: 7e5a0967a575c573c4727065d29b4c52a818e77a)
```

After ensuring `expo-gl` won't try to create a context for an invalid JS context reference the crash stopped occurring.

Mounting a `GLView` resulted in an unhandled Promise rejection:
```
[Unhandled promise rejection: TypeError: Cannot read property '-1' of undefined]
* /Users/sjchmiela/Applications/expo/packages/expo-gl/build/GLView.js:332:15 in getGl
* http://192.168.0.112:19000/__generated__/AppEntry.bundle?platform=android&dev=true&minify=false&hot=false:292922:50 in createContextAsync$
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:45:39 in tryCatch
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:274:21 in invoke
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:97:20 in prototype.method
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:45:39 in tryCatch
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:135:19 in invoke
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:145:12 in PromiseImpl.resolve.then$argument_0
* /Users/sjchmiela/Applications/expo/react-native-lab/react-native/node_modules/promise/setimmediate/core.js:37:11 in tryCallOne
* /Users/sjchmiela/Applications/expo/react-native-lab/react-native/node_modules/promise/setimmediate/core.js:123:14 in setImmediate$argument_0
```

so I decided to make it more readable. Now it's

```
[Unhandled promise rejection: Error: GL is currently not available. (Have you enabled remote debugging? GL is not available while debugging remotely.)]
* /Users/sjchmiela/Applications/expo/packages/expo-gl/build/GLView.js:333:9 in getGl
* http://192.168.0.112:19000/__generated__/AppEntry.bundle?platform=android&dev=true&minify=false&hot=false:292922:50 in createContextAsync$
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:45:39 in tryCatch
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:274:21 in invoke
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:97:20 in prototype.method
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:45:39 in tryCatch
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:135:19 in invoke
* /Users/sjchmiela/Applications/expo/node_modules/regenerator-runtime/runtime.js:145:12 in PromiseImpl.resolve.then$argument_0
* /Users/sjchmiela/Applications/expo/react-native-lab/react-native/node_modules/promise/setimmediate/core.js:37:11 in tryCallOne
* /Users/sjchmiela/Applications/expo/react-native-lab/react-native/node_modules/promise/setimmediate/core.js:123:14 in setImmediate$argument_0
```

I have ensured that debugging remotely doesn't crash the application if this is the only reason to do so.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants