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

Handle panic during conversion to connectCode #951

Merged
merged 2 commits into from
Aug 5, 2024
Merged

Handle panic during conversion to connectCode #951

merged 2 commits into from
Aug 5, 2024

Conversation

blurfx
Copy link
Member

@blurfx blurfx commented Aug 4, 2024

What this PR does / why we need it:

If an unhashable error is given, the error cannot be converted to a connecteError with a map, causing a panic and shutting down the server.

Which issue(s) this PR fixes:

Fixes #944

Special notes for your reviewer:

Would it be a good idea to log errors in recover?

Does this PR introduce a user-facing change?:


Additional documentation:


Checklist:

  • Added relevant tests or not required
  • Didn't break anything

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling in the connection status function to enhance resilience against runtime errors.
    • Implemented panic recovery to prevent unexpected failures during execution.
  • Tests
    • Introduced a test suite for the connection helper functions, ensuring robust error handling through various scenarios.

Copy link

coderabbitai bot commented Aug 4, 2024

Walkthrough

The recent changes enhance the errorToConnectError function by implementing panic recovery, ensuring the server handles non-hashable errors without crashing. This addition improves error resilience while retaining the function's clarity and original logic.

Changes

Files Change Summary
server/rpc/connecthelper/status.go Added panic recovery in errorToConnectError function to prevent server crashes from non-hashable errors. Variables connectCode and ok were moved to explicit declarations for clarity.
server/rpc/connecthelper/status_test.go Introduced a test suite for errorToConnectError, validating error type conversion and ensuring correct behavior for converter.ErrPackRequired and mongo.CommandError.

Assessment against linked issues

Objective Addressed Explanation
Server should not panic when handling non-hashable errors (#944)

🐇 "In the code where errors may lurk,
A safeguard now does its work!
With panics caught, we safely tread,
No more crashes, just stable threads.
A hop towards resilience, oh what a delight,
Errors handled, our future looks bright!" 🐰✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 54910c1 and 7e4273a.

Files selected for processing (1)
  • server/rpc/connecthelper/status.go (1 hunks)
Additional comments not posted (2)
server/rpc/connecthelper/status.go (2)

154-161: Good addition: Panic recovery mechanism.

The deferred function for panic recovery is a good addition to handle unhashable errors gracefully.


154-155: Improved readability: Explicit variable declarations.

Declaring connectCode and ok explicitly at the beginning of the function improves readability and debugging.

Copy link

codecov bot commented Aug 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.03%. Comparing base (54910c1) to head (79e6402).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #951      +/-   ##
==========================================
- Coverage   51.31%   51.03%   -0.29%     
==========================================
  Files          71       73       +2     
  Lines       10679    10774      +95     
==========================================
+ Hits         5480     5498      +18     
- Misses       4650     4725      +75     
- Partials      549      551       +2     

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

@krapie krapie self-requested a review August 4, 2024 12:42
@krapie krapie assigned krapie and blurfx and unassigned krapie Aug 4, 2024
@krapie krapie added the bug 🐞 Something isn't working label Aug 4, 2024
Copy link
Member

@krapie krapie left a comment

Choose a reason for hiding this comment

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

Fairly good enough to prevent panic. Does this print error details on panic or recover?

@blurfx
Copy link
Member Author

blurfx commented Aug 5, 2024

@krapie No, it doesn't. Should we print or log errors in this case?

@krapie
Copy link
Member

krapie commented Aug 5, 2024

@blurfx I think printing out error details may help us to take actions upon that specific error like mongo.CommandError.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Go Benchmark

Benchmark suite Current: 79e6402 Previous: 7e4273a Ratio
BenchmarkDocument/constructor_test 1533 ns/op 1337 B/op 24 allocs/op 1484 ns/op 1337 B/op 24 allocs/op 1.03
BenchmarkDocument/constructor_test - ns/op 1533 ns/op 1484 ns/op 1.03
BenchmarkDocument/constructor_test - B/op 1337 B/op 1337 B/op 1
BenchmarkDocument/constructor_test - allocs/op 24 allocs/op 24 allocs/op 1
BenchmarkDocument/status_test 963.7 ns/op 1305 B/op 22 allocs/op 954 ns/op 1305 B/op 22 allocs/op 1.01
BenchmarkDocument/status_test - ns/op 963.7 ns/op 954 ns/op 1.01
BenchmarkDocument/status_test - B/op 1305 B/op 1305 B/op 1
BenchmarkDocument/status_test - allocs/op 22 allocs/op 22 allocs/op 1
BenchmarkDocument/equals_test 7637 ns/op 7273 B/op 132 allocs/op 8664 ns/op 7273 B/op 132 allocs/op 0.88
BenchmarkDocument/equals_test - ns/op 7637 ns/op 8664 ns/op 0.88
BenchmarkDocument/equals_test - B/op 7273 B/op 7273 B/op 1
BenchmarkDocument/equals_test - allocs/op 132 allocs/op 132 allocs/op 1
BenchmarkDocument/nested_update_test 19405 ns/op 12139 B/op 262 allocs/op 17292 ns/op 12139 B/op 262 allocs/op 1.12
BenchmarkDocument/nested_update_test - ns/op 19405 ns/op 17292 ns/op 1.12
BenchmarkDocument/nested_update_test - B/op 12139 B/op 12139 B/op 1
BenchmarkDocument/nested_update_test - allocs/op 262 allocs/op 262 allocs/op 1
BenchmarkDocument/delete_test 22586 ns/op 15363 B/op 341 allocs/op 22631 ns/op 15363 B/op 341 allocs/op 1.00
BenchmarkDocument/delete_test - ns/op 22586 ns/op 22631 ns/op 1.00
BenchmarkDocument/delete_test - B/op 15363 B/op 15363 B/op 1
BenchmarkDocument/delete_test - allocs/op 341 allocs/op 341 allocs/op 1
BenchmarkDocument/object_test 8622 ns/op 6817 B/op 120 allocs/op 8670 ns/op 6817 B/op 120 allocs/op 0.99
BenchmarkDocument/object_test - ns/op 8622 ns/op 8670 ns/op 0.99
BenchmarkDocument/object_test - B/op 6817 B/op 6817 B/op 1
BenchmarkDocument/object_test - allocs/op 120 allocs/op 120 allocs/op 1
BenchmarkDocument/array_test 29069 ns/op 11947 B/op 276 allocs/op 29042 ns/op 11947 B/op 276 allocs/op 1.00
BenchmarkDocument/array_test - ns/op 29069 ns/op 29042 ns/op 1.00
BenchmarkDocument/array_test - B/op 11947 B/op 11947 B/op 1
BenchmarkDocument/array_test - allocs/op 276 allocs/op 276 allocs/op 1
BenchmarkDocument/text_test 30838 ns/op 14715 B/op 469 allocs/op 30670 ns/op 14715 B/op 469 allocs/op 1.01
BenchmarkDocument/text_test - ns/op 30838 ns/op 30670 ns/op 1.01
BenchmarkDocument/text_test - B/op 14715 B/op 14715 B/op 1
BenchmarkDocument/text_test - allocs/op 469 allocs/op 469 allocs/op 1
BenchmarkDocument/text_composition_test 28778 ns/op 18422 B/op 484 allocs/op 28854 ns/op 18422 B/op 484 allocs/op 1.00
BenchmarkDocument/text_composition_test - ns/op 28778 ns/op 28854 ns/op 1.00
BenchmarkDocument/text_composition_test - B/op 18422 B/op 18422 B/op 1
BenchmarkDocument/text_composition_test - allocs/op 484 allocs/op 484 allocs/op 1
BenchmarkDocument/rich_text_test 80400 ns/op 38476 B/op 1148 allocs/op 80221 ns/op 38475 B/op 1148 allocs/op 1.00
BenchmarkDocument/rich_text_test - ns/op 80400 ns/op 80221 ns/op 1.00
BenchmarkDocument/rich_text_test - B/op 38476 B/op 38475 B/op 1.00
BenchmarkDocument/rich_text_test - allocs/op 1148 allocs/op 1148 allocs/op 1
BenchmarkDocument/counter_test 17449 ns/op 10722 B/op 244 allocs/op 17831 ns/op 10722 B/op 244 allocs/op 0.98
BenchmarkDocument/counter_test - ns/op 17449 ns/op 17831 ns/op 0.98
BenchmarkDocument/counter_test - B/op 10722 B/op 10722 B/op 1
BenchmarkDocument/counter_test - allocs/op 244 allocs/op 244 allocs/op 1
BenchmarkDocument/text_edit_gc_100 1289860 ns/op 870981 B/op 16753 allocs/op 1335408 ns/op 870951 B/op 16753 allocs/op 0.97
BenchmarkDocument/text_edit_gc_100 - ns/op 1289860 ns/op 1335408 ns/op 0.97
BenchmarkDocument/text_edit_gc_100 - B/op 870981 B/op 870951 B/op 1.00
BenchmarkDocument/text_edit_gc_100 - allocs/op 16753 allocs/op 16753 allocs/op 1
BenchmarkDocument/text_edit_gc_1000 49891007 ns/op 50535292 B/op 181713 allocs/op 49997591 ns/op 50536382 B/op 181711 allocs/op 1.00
BenchmarkDocument/text_edit_gc_1000 - ns/op 49891007 ns/op 49997591 ns/op 1.00
BenchmarkDocument/text_edit_gc_1000 - B/op 50535292 B/op 50536382 B/op 1.00
BenchmarkDocument/text_edit_gc_1000 - allocs/op 181713 allocs/op 181711 allocs/op 1.00
BenchmarkDocument/text_split_gc_100 1864487 ns/op 1528770 B/op 15604 allocs/op 1868021 ns/op 1528879 B/op 15605 allocs/op 1.00
BenchmarkDocument/text_split_gc_100 - ns/op 1864487 ns/op 1868021 ns/op 1.00
BenchmarkDocument/text_split_gc_100 - B/op 1528770 B/op 1528879 B/op 1.00
BenchmarkDocument/text_split_gc_100 - allocs/op 15604 allocs/op 15605 allocs/op 1.00
BenchmarkDocument/text_split_gc_1000 111862180 ns/op 135079158 B/op 182219 allocs/op 110906832 ns/op 135077128 B/op 182204 allocs/op 1.01
BenchmarkDocument/text_split_gc_1000 - ns/op 111862180 ns/op 110906832 ns/op 1.01
BenchmarkDocument/text_split_gc_1000 - B/op 135079158 B/op 135077128 B/op 1.00
BenchmarkDocument/text_split_gc_1000 - allocs/op 182219 allocs/op 182204 allocs/op 1.00
BenchmarkDocument/text_delete_all_10000 15815476 ns/op 10183683 B/op 40678 allocs/op 15043786 ns/op 10182920 B/op 40675 allocs/op 1.05
BenchmarkDocument/text_delete_all_10000 - ns/op 15815476 ns/op 15043786 ns/op 1.05
BenchmarkDocument/text_delete_all_10000 - B/op 10183683 B/op 10182920 B/op 1.00
BenchmarkDocument/text_delete_all_10000 - allocs/op 40678 allocs/op 40675 allocs/op 1.00
BenchmarkDocument/text_delete_all_100000 276232059 ns/op 142674776 B/op 411671 allocs/op 268023936 ns/op 142645248 B/op 411632 allocs/op 1.03
BenchmarkDocument/text_delete_all_100000 - ns/op 276232059 ns/op 268023936 ns/op 1.03
BenchmarkDocument/text_delete_all_100000 - B/op 142674776 B/op 142645248 B/op 1.00
BenchmarkDocument/text_delete_all_100000 - allocs/op 411671 allocs/op 411632 allocs/op 1.00
BenchmarkDocument/text_100 227092 ns/op 120037 B/op 5081 allocs/op 216014 ns/op 120037 B/op 5081 allocs/op 1.05
BenchmarkDocument/text_100 - ns/op 227092 ns/op 216014 ns/op 1.05
BenchmarkDocument/text_100 - B/op 120037 B/op 120037 B/op 1
BenchmarkDocument/text_100 - allocs/op 5081 allocs/op 5081 allocs/op 1
BenchmarkDocument/text_1000 2468759 ns/op 1169026 B/op 50085 allocs/op 2362765 ns/op 1169040 B/op 50085 allocs/op 1.04
BenchmarkDocument/text_1000 - ns/op 2468759 ns/op 2362765 ns/op 1.04
BenchmarkDocument/text_1000 - B/op 1169026 B/op 1169040 B/op 1.00
BenchmarkDocument/text_1000 - allocs/op 50085 allocs/op 50085 allocs/op 1
BenchmarkDocument/array_1000 1277757 ns/op 1091404 B/op 11832 allocs/op 1215673 ns/op 1091363 B/op 11831 allocs/op 1.05
BenchmarkDocument/array_1000 - ns/op 1277757 ns/op 1215673 ns/op 1.05
BenchmarkDocument/array_1000 - B/op 1091404 B/op 1091363 B/op 1.00
BenchmarkDocument/array_1000 - allocs/op 11832 allocs/op 11831 allocs/op 1.00
BenchmarkDocument/array_10000 13297680 ns/op 9799434 B/op 120294 allocs/op 13349545 ns/op 9800080 B/op 120297 allocs/op 1.00
BenchmarkDocument/array_10000 - ns/op 13297680 ns/op 13349545 ns/op 1.00
BenchmarkDocument/array_10000 - B/op 9799434 B/op 9800080 B/op 1.00
BenchmarkDocument/array_10000 - allocs/op 120294 allocs/op 120297 allocs/op 1.00
BenchmarkDocument/array_gc_100 157870 ns/op 132739 B/op 1261 allocs/op 146563 ns/op 132717 B/op 1260 allocs/op 1.08
BenchmarkDocument/array_gc_100 - ns/op 157870 ns/op 146563 ns/op 1.08
BenchmarkDocument/array_gc_100 - B/op 132739 B/op 132717 B/op 1.00
BenchmarkDocument/array_gc_100 - allocs/op 1261 allocs/op 1260 allocs/op 1.00
BenchmarkDocument/array_gc_1000 1467244 ns/op 1159148 B/op 12877 allocs/op 1394329 ns/op 1159144 B/op 12876 allocs/op 1.05
BenchmarkDocument/array_gc_1000 - ns/op 1467244 ns/op 1394329 ns/op 1.05
BenchmarkDocument/array_gc_1000 - B/op 1159148 B/op 1159144 B/op 1.00
BenchmarkDocument/array_gc_1000 - allocs/op 12877 allocs/op 12876 allocs/op 1.00
BenchmarkDocument/counter_1000 216008 ns/op 193081 B/op 5771 allocs/op 201740 ns/op 193079 B/op 5771 allocs/op 1.07
BenchmarkDocument/counter_1000 - ns/op 216008 ns/op 201740 ns/op 1.07
BenchmarkDocument/counter_1000 - B/op 193081 B/op 193079 B/op 1.00
BenchmarkDocument/counter_1000 - allocs/op 5771 allocs/op 5771 allocs/op 1
BenchmarkDocument/counter_10000 2242108 ns/op 2087999 B/op 59778 allocs/op 2174283 ns/op 2088011 B/op 59778 allocs/op 1.03
BenchmarkDocument/counter_10000 - ns/op 2242108 ns/op 2174283 ns/op 1.03
BenchmarkDocument/counter_10000 - B/op 2087999 B/op 2088011 B/op 1.00
BenchmarkDocument/counter_10000 - allocs/op 59778 allocs/op 59778 allocs/op 1
BenchmarkDocument/object_1000 1461681 ns/op 1428185 B/op 9849 allocs/op 1381718 ns/op 1428153 B/op 9849 allocs/op 1.06
BenchmarkDocument/object_1000 - ns/op 1461681 ns/op 1381718 ns/op 1.06
BenchmarkDocument/object_1000 - B/op 1428185 B/op 1428153 B/op 1.00
BenchmarkDocument/object_1000 - allocs/op 9849 allocs/op 9849 allocs/op 1
BenchmarkDocument/object_10000 15581230 ns/op 12165882 B/op 100561 allocs/op 15089965 ns/op 12166231 B/op 100563 allocs/op 1.03
BenchmarkDocument/object_10000 - ns/op 15581230 ns/op 15089965 ns/op 1.03
BenchmarkDocument/object_10000 - B/op 12165882 B/op 12166231 B/op 1.00
BenchmarkDocument/object_10000 - allocs/op 100561 allocs/op 100563 allocs/op 1.00
BenchmarkDocument/tree_100 1083135 ns/op 943702 B/op 6101 allocs/op 1010609 ns/op 943700 B/op 6101 allocs/op 1.07
BenchmarkDocument/tree_100 - ns/op 1083135 ns/op 1010609 ns/op 1.07
BenchmarkDocument/tree_100 - B/op 943702 B/op 943700 B/op 1.00
BenchmarkDocument/tree_100 - allocs/op 6101 allocs/op 6101 allocs/op 1
BenchmarkDocument/tree_1000 79053923 ns/op 86460384 B/op 60114 allocs/op 72181839 ns/op 86460179 B/op 60114 allocs/op 1.10
BenchmarkDocument/tree_1000 - ns/op 79053923 ns/op 72181839 ns/op 1.10
BenchmarkDocument/tree_1000 - B/op 86460384 B/op 86460179 B/op 1.00
BenchmarkDocument/tree_1000 - allocs/op 60114 allocs/op 60114 allocs/op 1
BenchmarkDocument/tree_10000 9882780283 ns/op 8580667312 B/op 600207 allocs/op 9309059339 ns/op 8580672048 B/op 600229 allocs/op 1.06
BenchmarkDocument/tree_10000 - ns/op 9882780283 ns/op 9309059339 ns/op 1.06
BenchmarkDocument/tree_10000 - B/op 8580667312 B/op 8580672048 B/op 1.00
BenchmarkDocument/tree_10000 - allocs/op 600207 allocs/op 600229 allocs/op 1.00
BenchmarkDocument/tree_delete_all_1000 79408207 ns/op 87510146 B/op 75266 allocs/op 73413689 ns/op 87509849 B/op 75266 allocs/op 1.08
BenchmarkDocument/tree_delete_all_1000 - ns/op 79408207 ns/op 73413689 ns/op 1.08
BenchmarkDocument/tree_delete_all_1000 - B/op 87510146 B/op 87509849 B/op 1.00
BenchmarkDocument/tree_delete_all_1000 - allocs/op 75266 allocs/op 75266 allocs/op 1
BenchmarkDocument/tree_edit_gc_100 4024003 ns/op 4146731 B/op 15141 allocs/op 3876339 ns/op 4146750 B/op 15141 allocs/op 1.04
BenchmarkDocument/tree_edit_gc_100 - ns/op 4024003 ns/op 3876339 ns/op 1.04
BenchmarkDocument/tree_edit_gc_100 - B/op 4146731 B/op 4146750 B/op 1.00
BenchmarkDocument/tree_edit_gc_100 - allocs/op 15141 allocs/op 15141 allocs/op 1
BenchmarkDocument/tree_edit_gc_1000 319952706 ns/op 383744200 B/op 154852 allocs/op 295208726 ns/op 383745308 B/op 154848 allocs/op 1.08
BenchmarkDocument/tree_edit_gc_1000 - ns/op 319952706 ns/op 295208726 ns/op 1.08
BenchmarkDocument/tree_edit_gc_1000 - B/op 383744200 B/op 383745308 B/op 1.00
BenchmarkDocument/tree_edit_gc_1000 - allocs/op 154852 allocs/op 154848 allocs/op 1.00
BenchmarkDocument/tree_split_gc_100 2673525 ns/op 2412514 B/op 11125 allocs/op 2499345 ns/op 2412485 B/op 11125 allocs/op 1.07
BenchmarkDocument/tree_split_gc_100 - ns/op 2673525 ns/op 2499345 ns/op 1.07
BenchmarkDocument/tree_split_gc_100 - B/op 2412514 B/op 2412485 B/op 1.00
BenchmarkDocument/tree_split_gc_100 - allocs/op 11125 allocs/op 11125 allocs/op 1
BenchmarkDocument/tree_split_gc_1000 195976872 ns/op 222253373 B/op 122006 allocs/op 180621356 ns/op 222251892 B/op 121991 allocs/op 1.09
BenchmarkDocument/tree_split_gc_1000 - ns/op 195976872 ns/op 180621356 ns/op 1.09
BenchmarkDocument/tree_split_gc_1000 - B/op 222253373 B/op 222251892 B/op 1.00
BenchmarkDocument/tree_split_gc_1000 - allocs/op 122006 allocs/op 121991 allocs/op 1.00
BenchmarkRPC/client_to_server 380814339 ns/op 16971229 B/op 175373 allocs/op 377903152 ns/op 17506562 B/op 175375 allocs/op 1.01
BenchmarkRPC/client_to_server - ns/op 380814339 ns/op 377903152 ns/op 1.01
BenchmarkRPC/client_to_server - B/op 16971229 B/op 17506562 B/op 0.97
BenchmarkRPC/client_to_server - allocs/op 175373 allocs/op 175375 allocs/op 1.00
BenchmarkRPC/client_to_client_via_server 634605926 ns/op 33416656 B/op 320593 allocs/op 631592547 ns/op 34700640 B/op 321164 allocs/op 1.00
BenchmarkRPC/client_to_client_via_server - ns/op 634605926 ns/op 631592547 ns/op 1.00
BenchmarkRPC/client_to_client_via_server - B/op 33416656 B/op 34700640 B/op 0.96
BenchmarkRPC/client_to_client_via_server - allocs/op 320593 allocs/op 321164 allocs/op 1.00
BenchmarkRPC/attach_large_document 1390146129 ns/op 1895465328 B/op 8869 allocs/op 1362823970 ns/op 1919918168 B/op 8872 allocs/op 1.02
BenchmarkRPC/attach_large_document - ns/op 1390146129 ns/op 1362823970 ns/op 1.02
BenchmarkRPC/attach_large_document - B/op 1895465328 B/op 1919918168 B/op 0.99
BenchmarkRPC/attach_large_document - allocs/op 8869 allocs/op 8872 allocs/op 1.00
BenchmarkRPC/adminCli_to_server 554566008 ns/op 35972076 B/op 289550 allocs/op 557714400 ns/op 35965656 B/op 289581 allocs/op 0.99
BenchmarkRPC/adminCli_to_server - ns/op 554566008 ns/op 557714400 ns/op 0.99
BenchmarkRPC/adminCli_to_server - B/op 35972076 B/op 35965656 B/op 1.00
BenchmarkRPC/adminCli_to_server - allocs/op 289550 allocs/op 289581 allocs/op 1.00
BenchmarkLocker 74.91 ns/op 16 B/op 1 allocs/op 64.3 ns/op 16 B/op 1 allocs/op 1.17
BenchmarkLocker - ns/op 74.91 ns/op 64.3 ns/op 1.17
BenchmarkLocker - B/op 16 B/op 16 B/op 1
BenchmarkLocker - allocs/op 1 allocs/op 1 allocs/op 1
BenchmarkLockerParallel 39.24 ns/op 0 B/op 0 allocs/op 39.32 ns/op 0 B/op 0 allocs/op 1.00
BenchmarkLockerParallel - ns/op 39.24 ns/op 39.32 ns/op 1.00
BenchmarkLockerParallel - B/op 0 B/op 0 B/op 1
BenchmarkLockerParallel - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkLockerMoreKeys 150.1 ns/op 15 B/op 0 allocs/op 147.4 ns/op 15 B/op 0 allocs/op 1.02
BenchmarkLockerMoreKeys - ns/op 150.1 ns/op 147.4 ns/op 1.02
BenchmarkLockerMoreKeys - B/op 15 B/op 15 B/op 1
BenchmarkLockerMoreKeys - allocs/op 0 allocs/op 0 allocs/op 1
BenchmarkChange/Push_10_Changes 3927515 ns/op 121382 B/op 1284 allocs/op 3927557 ns/op 121534 B/op 1285 allocs/op 1.00
BenchmarkChange/Push_10_Changes - ns/op 3927515 ns/op 3927557 ns/op 1.00
BenchmarkChange/Push_10_Changes - B/op 121382 B/op 121534 B/op 1.00
BenchmarkChange/Push_10_Changes - allocs/op 1284 allocs/op 1285 allocs/op 1.00
BenchmarkChange/Push_100_Changes 14497890 ns/op 574615 B/op 6654 allocs/op 14659884 ns/op 571917 B/op 6654 allocs/op 0.99
BenchmarkChange/Push_100_Changes - ns/op 14497890 ns/op 14659884 ns/op 0.99
BenchmarkChange/Push_100_Changes - B/op 574615 B/op 571917 B/op 1.00
BenchmarkChange/Push_100_Changes - allocs/op 6654 allocs/op 6654 allocs/op 1
BenchmarkChange/Push_1000_Changes 115932368 ns/op 5288668 B/op 63148 allocs/op 117264388 ns/op 5196928 B/op 63146 allocs/op 0.99
BenchmarkChange/Push_1000_Changes - ns/op 115932368 ns/op 117264388 ns/op 0.99
BenchmarkChange/Push_1000_Changes - B/op 5288668 B/op 5196928 B/op 1.02
BenchmarkChange/Push_1000_Changes - allocs/op 63148 allocs/op 63146 allocs/op 1.00
BenchmarkChange/Pull_10_Changes 2918769 ns/op 100683 B/op 1004 allocs/op 2923870 ns/op 100808 B/op 1004 allocs/op 1.00
BenchmarkChange/Pull_10_Changes - ns/op 2918769 ns/op 2923870 ns/op 1.00
BenchmarkChange/Pull_10_Changes - B/op 100683 B/op 100808 B/op 1.00
BenchmarkChange/Pull_10_Changes - allocs/op 1004 allocs/op 1004 allocs/op 1
BenchmarkChange/Pull_100_Changes 4383303 ns/op 265934 B/op 3475 allocs/op 4317221 ns/op 266360 B/op 3475 allocs/op 1.02
BenchmarkChange/Pull_100_Changes - ns/op 4383303 ns/op 4317221 ns/op 1.02
BenchmarkChange/Pull_100_Changes - B/op 265934 B/op 266360 B/op 1.00
BenchmarkChange/Pull_100_Changes - allocs/op 3475 allocs/op 3475 allocs/op 1
BenchmarkChange/Pull_1000_Changes 8629730 ns/op 1493215 B/op 29860 allocs/op 8473007 ns/op 1491060 B/op 29864 allocs/op 1.02
BenchmarkChange/Pull_1000_Changes - ns/op 8629730 ns/op 8473007 ns/op 1.02
BenchmarkChange/Pull_1000_Changes - B/op 1493215 B/op 1491060 B/op 1.00
BenchmarkChange/Pull_1000_Changes - allocs/op 29860 allocs/op 29864 allocs/op 1.00
BenchmarkSnapshot/Push_3KB_snapshot 16868279 ns/op 709256 B/op 6654 allocs/op 16902530 ns/op 716872 B/op 6656 allocs/op 1.00
BenchmarkSnapshot/Push_3KB_snapshot - ns/op 16868279 ns/op 16902530 ns/op 1.00
BenchmarkSnapshot/Push_3KB_snapshot - B/op 709256 B/op 716872 B/op 0.99
BenchmarkSnapshot/Push_3KB_snapshot - allocs/op 6654 allocs/op 6656 allocs/op 1.00
BenchmarkSnapshot/Push_30KB_snapshot 119759705 ns/op 5487326 B/op 63147 allocs/op 120835176 ns/op 5593667 B/op 63149 allocs/op 0.99
BenchmarkSnapshot/Push_30KB_snapshot - ns/op 119759705 ns/op 120835176 ns/op 0.99
BenchmarkSnapshot/Push_30KB_snapshot - B/op 5487326 B/op 5593667 B/op 0.98
BenchmarkSnapshot/Push_30KB_snapshot - allocs/op 63147 allocs/op 63149 allocs/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot 6420145 ns/op 922658 B/op 15513 allocs/op 6381163 ns/op 923436 B/op 15511 allocs/op 1.01
BenchmarkSnapshot/Pull_3KB_snapshot - ns/op 6420145 ns/op 6381163 ns/op 1.01
BenchmarkSnapshot/Pull_3KB_snapshot - B/op 922658 B/op 923436 B/op 1.00
BenchmarkSnapshot/Pull_3KB_snapshot - allocs/op 15513 allocs/op 15511 allocs/op 1.00
BenchmarkSnapshot/Pull_30KB_snapshot 15225633 ns/op 7158577 B/op 150105 allocs/op 15095575 ns/op 7146866 B/op 150060 allocs/op 1.01
BenchmarkSnapshot/Pull_30KB_snapshot - ns/op 15225633 ns/op 15095575 ns/op 1.01
BenchmarkSnapshot/Pull_30KB_snapshot - B/op 7158577 B/op 7146866 B/op 1.00
BenchmarkSnapshot/Pull_30KB_snapshot - allocs/op 150105 allocs/op 150060 allocs/op 1.00
BenchmarkSync/memory_sync_10_test 7874 ns/op 1287 B/op 38 allocs/op 8198 ns/op 1286 B/op 38 allocs/op 0.96
BenchmarkSync/memory_sync_10_test - ns/op 7874 ns/op 8198 ns/op 0.96
BenchmarkSync/memory_sync_10_test - B/op 1287 B/op 1286 B/op 1.00
BenchmarkSync/memory_sync_10_test - allocs/op 38 allocs/op 38 allocs/op 1
BenchmarkSync/memory_sync_100_test 59201 ns/op 8967 B/op 293 allocs/op 58978 ns/op 8973 B/op 294 allocs/op 1.00
BenchmarkSync/memory_sync_100_test - ns/op 59201 ns/op 58978 ns/op 1.00
BenchmarkSync/memory_sync_100_test - B/op 8967 B/op 8973 B/op 1.00
BenchmarkSync/memory_sync_100_test - allocs/op 293 allocs/op 294 allocs/op 1.00
BenchmarkSync/memory_sync_1000_test 421002 ns/op 83321 B/op 2680 allocs/op 444239 ns/op 81736 B/op 2584 allocs/op 0.95
BenchmarkSync/memory_sync_1000_test - ns/op 421002 ns/op 444239 ns/op 0.95
BenchmarkSync/memory_sync_1000_test - B/op 83321 B/op 81736 B/op 1.02
BenchmarkSync/memory_sync_1000_test - allocs/op 2680 allocs/op 2584 allocs/op 1.04
BenchmarkSync/memory_sync_10000_test 4305032 ns/op 806901 B/op 24390 allocs/op 7185421 ns/op 736651 B/op 20306 allocs/op 0.60
BenchmarkSync/memory_sync_10000_test - ns/op 4305032 ns/op 7185421 ns/op 0.60
BenchmarkSync/memory_sync_10000_test - B/op 806901 B/op 736651 B/op 1.10
BenchmarkSync/memory_sync_10000_test - allocs/op 24390 allocs/op 20306 allocs/op 1.20
BenchmarkTextEditing 5243279634 ns/op 3901916224 B/op 18743201 allocs/op 5056403661 ns/op 3901891520 B/op 18743135 allocs/op 1.04
BenchmarkTextEditing - ns/op 5243279634 ns/op 5056403661 ns/op 1.04
BenchmarkTextEditing - B/op 3901916224 B/op 3901891520 B/op 1.00
BenchmarkTextEditing - allocs/op 18743201 allocs/op 18743135 allocs/op 1.00
BenchmarkTree/10000_vertices_to_protobuf 3517889 ns/op 6262972 B/op 70025 allocs/op 3462203 ns/op 6262992 B/op 70025 allocs/op 1.02
BenchmarkTree/10000_vertices_to_protobuf - ns/op 3517889 ns/op 3462203 ns/op 1.02
BenchmarkTree/10000_vertices_to_protobuf - B/op 6262972 B/op 6262992 B/op 1.00
BenchmarkTree/10000_vertices_to_protobuf - allocs/op 70025 allocs/op 70025 allocs/op 1
BenchmarkTree/10000_vertices_from_protobuf 156410559 ns/op 442171457 B/op 290039 allocs/op 152115847 ns/op 442171390 B/op 290038 allocs/op 1.03
BenchmarkTree/10000_vertices_from_protobuf - ns/op 156410559 ns/op 152115847 ns/op 1.03
BenchmarkTree/10000_vertices_from_protobuf - B/op 442171457 B/op 442171390 B/op 1.00
BenchmarkTree/10000_vertices_from_protobuf - allocs/op 290039 allocs/op 290038 allocs/op 1.00
BenchmarkTree/20000_vertices_to_protobuf 7832380 ns/op 12716982 B/op 140028 allocs/op 7535470 ns/op 12716979 B/op 140028 allocs/op 1.04
BenchmarkTree/20000_vertices_to_protobuf - ns/op 7832380 ns/op 7535470 ns/op 1.04
BenchmarkTree/20000_vertices_to_protobuf - B/op 12716982 B/op 12716979 B/op 1.00
BenchmarkTree/20000_vertices_to_protobuf - allocs/op 140028 allocs/op 140028 allocs/op 1
BenchmarkTree/20000_vertices_from_protobuf 691567172 ns/op 1697267880 B/op 580043 allocs/op 673532122 ns/op 1697268464 B/op 580089 allocs/op 1.03
BenchmarkTree/20000_vertices_from_protobuf - ns/op 691567172 ns/op 673532122 ns/op 1.03
BenchmarkTree/20000_vertices_from_protobuf - B/op 1697267880 B/op 1697268464 B/op 1.00
BenchmarkTree/20000_vertices_from_protobuf - allocs/op 580043 allocs/op 580089 allocs/op 1.00
BenchmarkTree/30000_vertices_to_protobuf 12417490 ns/op 19318502 B/op 210031 allocs/op 12031534 ns/op 19318406 B/op 210030 allocs/op 1.03
BenchmarkTree/30000_vertices_to_protobuf - ns/op 12417490 ns/op 12031534 ns/op 1.03
BenchmarkTree/30000_vertices_to_protobuf - B/op 19318502 B/op 19318406 B/op 1.00
BenchmarkTree/30000_vertices_to_protobuf - allocs/op 210031 allocs/op 210030 allocs/op 1.00
BenchmarkTree/30000_vertices_from_protobuf 1621775329 ns/op 3752036024 B/op 870047 allocs/op 1626778191 ns/op 3752044488 B/op 870050 allocs/op 1.00
BenchmarkTree/30000_vertices_from_protobuf - ns/op 1621775329 ns/op 1626778191 ns/op 1.00
BenchmarkTree/30000_vertices_from_protobuf - B/op 3752036024 B/op 3752044488 B/op 1.00
BenchmarkTree/30000_vertices_from_protobuf - allocs/op 870047 allocs/op 870050 allocs/op 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (1)
server/rpc/connecthelper/status_test.go (1)

29-39: Test function is well-structured and covers necessary cases.

The test function TestStatus is well-structured and covers the necessary test cases for errorToConnectError. Consider adding more test cases for different error types to improve coverage.

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7e4273a and 79e6402.

Files selected for processing (2)
  • server/rpc/connecthelper/status.go (1 hunks)
  • server/rpc/connecthelper/status_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • server/rpc/connecthelper/status.go
Additional comments not posted (2)
server/rpc/connecthelper/status_test.go (2)

1-17: License header and package declaration are correct.

The license header follows the standard format and the package declaration is correct.


19-27: Import statements are relevant and necessary.

The import statements include necessary packages for testing, assertion, and MongoDB.

@hackerwins
Copy link
Member

@krapie @blurfx It seems that an error will propagate to the callers and be output by the interceptor. 🤔

if err != nil {
reqLogger.Warnf("RPC : %q %s: %q => %q", req.Spec().Procedure, gotime.Since(start), req, err)
return nil, connecthelper.ToStatusError(err)
}

@hackerwins hackerwins self-requested a review August 5, 2024 06:31
Copy link
Member

@hackerwins hackerwins left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution.

@hackerwins hackerwins merged commit 0c93460 into main Aug 5, 2024
4 checks passed
@hackerwins hackerwins deleted the fix/944 branch August 5, 2024 06:32
raararaara pushed a commit that referenced this pull request Oct 7, 2024
If an unhashable error is given, the error cannot be converted to a
ConnectError with a map, causing a panic and shutting down the server.

---------

Co-authored-by: Youngteac Hong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Server panics due to convert unhashable struct to connnect.Error
3 participants