Skip to content

Don't crash SDK is socket.close() fails #2216

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

Merged
merged 3 commits into from
Dec 2, 2020
Merged

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Dec 1, 2020

On some Pixel devices, socket.close() throws an NPE (might be related to google/conscrypt#331).

Fixes b/164528104

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Dec 1, 2020

Coverage Report

Affected SDKs

  • firebase-database

    SDK overall coverage changed from 50.35% (141830d) to 50.36% (af627623) by +0.01%.

    Filename Base (141830d) Head (af627623) Diff
    QueryParams.java 89.76% 90.36% +0.60%

Test Logs

Notes

HTML coverage reports can be produced locally with ./gradlew <product>:checkCoverage.
Report files are located at <product-build-dir>/reports/jacoco/.

Head commit (af627623) is created by Prow via merging commits: 141830d eb4f8f8.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Dec 1, 2020

Binary Size Report

Affected SDKs

  • firebase-database

    Type Base (141830d) Head (af627623) Diff
    aar 490 kB 490 kB +28 B (+0.0%)
    apk (release) 1.09 MB 1.09 MB +72 B (+0.0%)

Test Logs

Notes

Head commit (af627623) is created by Prow via merging commits: 141830d eb4f8f8.

@@ -261,8 +261,8 @@ private synchronized void closeSocket() {
if (socket != null) {
try {
socket.close();
} catch (IOException e) {
throw new RuntimeException(e);
} catch (Throwable e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

catching Throwable seems a little bit aggressive as it will also catch java.lang.Errors which, according to its javadoc, "a reasonable application should not try to catch". Would it be sufficient to only catch Exception for example?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. I only mean to catch IOException and NPEs here.

@schmidt-sebastian schmidt-sebastian merged commit 00e6a8d into master Dec 2, 2020
@google-oss-bot
Copy link
Contributor

@schmidt-sebastian: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
smoke-tests eb4f8f8 link /test smoke-tests

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

vkryachko pushed a commit that referenced this pull request Dec 15, 2020
* RTDB Query get method must be public (#2231)

* Don't crash SDK is socket.close() fails (#2216)

Co-authored-by: Jan Wyszynski <[email protected]>
Co-authored-by: Sebastian Schmidt <[email protected]>
@firebase firebase locked and limited conversation to collaborators Jan 2, 2021
@kaibolay kaibolay deleted the mrschmidt/npe branch September 15, 2022 13:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants