Skip to content

Fix/storage emulator json stream - #6615

Open
benjaminpetersen wants to merge 2 commits into
firebase:mainfrom
benjaminpetersen:fix/storage-emulator-json-stream
Open

Fix/storage emulator json stream#6615
benjaminpetersen wants to merge 2 commits into
firebase:mainfrom
benjaminpetersen:fix/storage-emulator-json-stream

Conversation

@benjaminpetersen

Copy link
Copy Markdown

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

@google-cla

google-cla Bot commented Dec 13, 2023

Copy link
Copy Markdown

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.

@benjaminpetersen

Copy link
Copy Markdown
Author

It seems I can't agree to the CLA

@joehan
joehan requested a review from tonyjhuang January 8, 2024 19:42
@abhis3

abhis3 commented Jan 12, 2024

Copy link
Copy Markdown
Contributor

Thanks for the fix!! 🚀

@codecov-commenter

Copy link
Copy Markdown

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 ⚠️
src/emulator/storage/rules/runtime.ts 12.50% 7 Missing ⚠️
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              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@christhompsongoogle

Copy link
Copy Markdown
Contributor

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

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.

5 participants