-
Notifications
You must be signed in to change notification settings - Fork 608
Fix bug that let responsePayloadBytes get set to -1 #6721
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
Conversation
📝 PRs merging into main branchOur main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released. |
Test Results 110 files - 76 110 suites - 76 2m 18s ⏱️ - 2m 8s Results for commit 529bb6c. ± Comparison against base commit ec26a52. This pull request removes 1235 and adds 970 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
Coverage Report 1Affected Products
Test Logs |
Size Report 1Affected Products
Test Logs |
firebase-perf/src/main/java/com/google/firebase/perf/network/InstrHttpInputStream.java
Show resolved
Hide resolved
firebase-perf/src/main/java/com/google/firebase/perf/network/InstrHttpInputStream.java
Show resolved
Hide resolved
firebase-perf/src/main/java/com/google/firebase/perf/network/InstrHttpInputStream.java
Show resolved
Hide resolved
Fix a bug in `InstrHttpInputStream` that let `NetworkRequestMetric.responsePayloadBytes` get set to -1 in some conditions. While investigating [b/398063523](http://b/398063523), I found that `inputStream.read(...)` can return 0 in some cases, for example, when the byte buffer length is 0. When this happens, it was possible to set `responsePayloadBytes` to -1 because `-1 + 0 = -1`. I didn't just have `bytesRead` initialize to 0 because there is a difference between 0 bytes read, and no read happened. Tested manually by hacking a test app to force this to happen, and by unit tests.
Fix a bug in
InstrHttpInputStream
that letNetworkRequestMetric.responsePayloadBytes
get set to -1 in some conditions.While investigating b/398063523, I found that
inputStream.read(...)
can return 0 in some cases, for example, when the byte buffer length is 0. When this happens, it was possible to setresponsePayloadBytes
to -1 because-1 + 0 = -1
. I didn't just havebytesRead
initialize to 0 because there is a difference between 0 bytes read, and no read happened. Tested manually by hacking a test app to force this to happen, and by unit tests.