ui: fix crash on debug hot ranges page#162613
Open
dhartunian wants to merge 1 commit intocockroachdb:masterfrom
Open
ui: fix crash on debug hot ranges page#162613dhartunian wants to merge 1 commit intocockroachdb:masterfrom
dhartunian wants to merge 1 commit intocockroachdb:masterfrom
Conversation
The debug hot ranges page at /#/debug/hotranges crashed on load with `TypeError: Cannot read properties of undefined (reading 'length')`. When no `node_id` URL parameter was present, `nodeId` was `undefined`, causing `nodes: [undefined]` to be passed to the HotRangesRequest protobuf constructor. The protobuf encoder then tried to compute the UTF-8 length of `undefined`, which has no `.length` property. The fix filters out the undefined value by using an empty array when `nodeId` is not set, which correctly requests hot ranges for all nodes. The top ranges page at /#/topranges does not have this bug because it guards with `if (filters.nodeIds.length > 0)` before constructing the request. Fixes: cockroachdb#160556 Release note: None Epic: None
Contributor
|
Merging to
|
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The debug hot ranges page at /#/debug/hotranges crashed on load with
TypeError: Cannot read properties of undefined (reading 'length'). When nonode_idURL parameter was present,nodeIdwasundefined, causingnodes: [undefined]to be passed to the HotRangesRequest protobuf constructor. The protobuf encoder then tried to compute the UTF-8 length ofundefined, which has no.lengthproperty.The fix filters out the undefined value by using an empty array when
nodeIdis not set, which correctly requests hot ranges for all nodes.The top ranges page at /#/topranges does not have this bug because it guards with
if (filters.nodeIds.length > 0)before constructing the request.Fixes: #160556
Release note: None
Epic: None