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: Decode ComponentId to avoid UI throwing errors #3827

Conversation

paxadax
Copy link
Contributor

@paxadax paxadax commented Jan 10, 2025

What is the purpose of the change

After bumping our Storm services from Storm 1 to Storm 2, we faced an issue where some components fail to load through the UI.

500 Server Error
org.apache.storm.thrift.TApplicationException: Internal error processing getComponentPageInfo

Findings:
We verified that the getComponentPageInfo method works correctly for Spouts and Bolts with names that do not contain spaces.
However, it fails for components with names that contain spaces.
Root Cause:
The issue lies on how the parameter componentId is being passed. For example, in the StatsUtils.componentType method:

public static String componentType(StormTopology topology, String compId) {
if (compId == null) {
return null;
}

Map<String, Bolt> bolts = topology.get_bolts();
if (Utils.isSystemId(compId) || bolts.containsKey(compId)) {
    return ClientStatsUtil.BOLT;
}
return ClientStatsUtil.SPOUT;

}

Error Scenario:

When accessing the component page of a Bolt named Test Error, the compId value is "Test+Error".
However, in the bolts map, the component key is stored as "Test Error".
This mismatch prevents the bolts map from finding the component, leading the method to incorrectly return the SPOUT value for a Bolt.

On this PR we're decoding the componentId string so it will match the correct value.

How was the change tested

Compiled the project, copied the jar into my machine and verified that the UI is now loading the components for names with spaces

@reiabreu reiabreu merged commit 457194d into apache:master Jan 10, 2025
12 checks passed
@rzo1
Copy link
Contributor

rzo1 commented Jan 10, 2025

@reiabreu
Copy link
Contributor

reiabreu commented Jan 10, 2025 via email

@paxadax
Copy link
Contributor Author

paxadax commented Jan 10, 2025

Hey, sorry, I've forgot to link the issue, we had already created.

https://issues.apache.org/jira/browse/STORM-4148

@rzo1
Copy link
Contributor

rzo1 commented Jan 10, 2025

Thanks for the PR @paxadax

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.

4 participants