-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Use ConcurrentHashMap for handling concurrent Android websockets, and… #17884
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
I've completed the CLA on https://code.facebook.com/cla, as requested by facebook-github-bot. Please let me know if any other action is necessary. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
cc @hramos Would be great to get this landed |
@sunweiyang please rebase and I can look into getting this imported. Thanks! |
… prevent unknown websocket IDs from crashing on Android (show warning on development builds instead)
@hramos, rebased as requested. |
I modified the code according to your PR, and the first break will not cause a crash, but the second one is the same error. |
@yewenxiang23, the following RuntimeException have been removed whenever a websocket ID is unknown, so I'm not sure what is causing your error:
Can you check your app's logcat to see where the failure occurred, and if it's related to this PR's changes to WebSocketModule.java (or somewhere else)? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hramos is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
|
@yewenxiang23 from the error message it looks like you are using the old code since this error message is removed in the PR. are you compiling from source? |
@satya164 Sorry I'm a little don't understand you mean, I have updated the version the react - native 0.53.0, and found the android when websocket disconnect the second reconnection, or there will be a flash back, I according to the modified the WebSocketModule PR file, will appear this problem, the IOS above is not the problem. |
@yewenxiang23 modifying the files is not enough. you also need to compile from source https://facebook.github.io/react-native/docs/android-building-from-source.html |
@satya164 Thank you very much for your answer. I will try it now. |
Summary: … prevent unknown websocket IDs from crashing on Android (show warning on development builds instead) This PR addresses facebook#3346; an unknown websocket ID should produce a warning during development, but not cause crashes in production RN apps. This PR was created by satya164's request, and was inspired by tanthanh289's suggestion on facebook#3346's thread. On Android, create a websocket using a service like Pusher (`pusher-js` npm package) or manually, and then induce removal of its websocket ID. Result should be a red warning screen during development, and no crash in the app's release variant. [ANDROID] [BUGFIX] [WebSocket] - Prevent unknown websocket IDs from crashing on Android Closes facebook#17884 Differential Revision: D6954038 Pulled By: hramos fbshipit-source-id: b346d80d7568996b8819c0de54552abb534cbfae
… prevent unknown websocket IDs from crashing on Android (show warning on development builds instead)
Motivation
This PR addresses #3346; an unknown websocket ID should produce a warning during development, but not cause crashes in production RN apps. This PR was created by @satya164's request, and was inspired by @tanthanh289's suggestion on #3346's thread.
Test Plan
On Android, create a websocket using a service like Pusher (
pusher-js
npm package) or manually, and then induce removal of its websocket ID. Result should be a red warning screen during development, and no crash in the app's release variant.Release Notes
[ANDROID] [BUGFIX] [WebSocket] - Prevent unknown websocket IDs from crashing on Android