firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

Fix/storage emulator json stream

Open benjaminpetersen opened this issue 2 years ago • 5 comments

Description

Sometimes the storage emulator fails to resolve and the network request remains in a pending state. The problem comes from the java subprocess. When a received chunk includes a non-json log or 2 json objects the parse command fails, logs, and returns. The fix I implemented is finding matching brackets and parsing the content in those.

Linked issue: #6194

Scenarios Tested

[FIXED]: When users add debug(...) to storage.rules files, the requests intermittently hang. [FIXED]: When hundreds of requests go out sometimes response get tangled.

Sample Commands

benjaminpetersen avatar Dec 13 '23 23:12 benjaminpetersen

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Dec 13 '23 23:12 google-cla[bot]

It seems I can't agree to the CLA

benjaminpetersen avatar Dec 13 '23 23:12 benjaminpetersen

Thanks for the fix!! 🚀

abhis3 avatar Jan 12 '24 05:01 abhis3

Codecov Report

Attention: 38 lines in your changes are missing coverage. Please review.

Comparison is base (a6f052e) 54.28% compared to head (73b3c50) 54.23%. Report is 17 commits behind head on master.

Files Patch % Lines
src/emulator/jsonUtils.ts 18.42% 31 Missing :warning:
src/emulator/storage/rules/runtime.ts 12.50% 7 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6615      +/-   ##
==========================================
- Coverage   54.28%   54.23%   -0.06%     
==========================================
  Files         347      348       +1     
  Lines       24077    24116      +39     
  Branches     4971     4986      +15     
==========================================
+ Hits        13071    13079       +8     
- Misses       9806     9837      +31     
  Partials     1200     1200              

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar Jan 12 '24 05:01 codecov-commenter

Thank you Benjamin, would you be willing to add some test coverage for this case?

christhompsongoogle avatar May 29 '25 19:05 christhompsongoogle