Skip to content
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

[fix][fn] check user metric len before iterating #20021

Merged
merged 3 commits into from
Apr 13, 2023

Conversation

flowchartsman
Copy link
Contributor

@flowchartsman flowchartsman commented Apr 5, 2023

Fixes #20020

Modifications

check for len() == 0 before iterating, otherwise return empty map.

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • *New test exercises failure condition (panics without fix), and tests instance communication besides. Also adds a helper for similar tests, should they need it.

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • The metrics
  • Anything that affects deployment

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: flowchartsman#1

@github-actions
Copy link

github-actions bot commented Apr 5, 2023

@flowchartsman Please add the following content to your PR description and select a checkbox:

- [ ] `doc` <!-- Your PR contains doc changes -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->

@github-actions github-actions bot added doc-not-needed Your PR changes do not impact docs and removed doc-label-missing labels Apr 5, 2023
@tisonkun tisonkun changed the title [FIX][pulsar-function-go]check user metric len before iterating [fix][fn] check user metric len before iterating Apr 12, 2023
Copy link
Member

@tisonkun tisonkun left a comment

Choose a reason for hiding this comment

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

LGTM

Thanks for taking care of this!

@codecov-commenter
Copy link

Codecov Report

Merging #20021 (be67293) into master (3b118b6) will increase coverage by 0.00%.
The diff coverage is 44.60%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #20021   +/-   ##
=========================================
  Coverage     72.86%   72.86%           
- Complexity    31628    31634    +6     
=========================================
  Files          1861     1858    -3     
  Lines        137500   137424   -76     
  Branches      15141    15107   -34     
=========================================
- Hits         100187   100136   -51     
+ Misses        29351    29301   -50     
- Partials       7962     7987   +25     
Flag Coverage Δ
inttests 24.35% <0.95%> (-0.05%) ⬇️
systests 24.87% <20.14%> (-0.15%) ⬇️
unittests 72.15% <35.49%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...a/org/apache/pulsar/broker/admin/v2/Functions.java 0.00% <0.00%> (ø)
...java/org/apache/pulsar/broker/admin/v2/Worker.java 11.76% <0.00%> (ø)
...org/apache/pulsar/broker/admin/v2/WorkerStats.java 40.00% <0.00%> (ø)
...ons/worker/rest/api/v2/FunctionsApiV2Resource.java 0.00% <0.00%> (ø)
...s/worker/rest/api/v2/WorkerStatsApiV2Resource.java 0.00% <0.00%> (ø)
...ulsar/functions/worker/rest/api/FunctionsImpl.java 56.55% <16.66%> (-0.74%) ⬇️
...org/apache/pulsar/broker/admin/impl/SinksBase.java 35.29% <35.71%> (ø)
...g/apache/pulsar/broker/admin/impl/SourcesBase.java 35.29% <35.71%> (-1.85%) ⬇️
...ons/worker/rest/api/v3/FunctionsApiV3Resource.java 43.39% <37.50%> (ø)
...e/pulsar/functions/worker/rest/api/WorkerImpl.java 14.90% <38.46%> (+9.38%) ⬆️
... and 15 more

... and 65 files with indirect coverage changes

@tisonkun
Copy link
Member

Merging...

@flowchartsman Thanks for your contribution! You can ping me as a reviewer the next time for usability changes.

@tisonkun tisonkun merged commit 52e8144 into apache:master Apr 13, 2023
@poorbarcode poorbarcode added this to the 3.1.0 milestone May 7, 2023
poorbarcode pushed a commit that referenced this pull request May 7, 2023
Co-authored-by: Andy Walker <andy@andy.dev>
(cherry picked from commit 52e8144)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] [pulsar-function-go] - bounds check issue on user metrics causing go function crash for stats command
5 participants