Ethan Li created STORM-3619:
-------------------------------

             Summary: Add null check for the topology name
                 Key: STORM-3619
                 URL: https://issues.apache.org/jira/browse/STORM-3619
             Project: Apache Storm
          Issue Type: Improvement
            Reporter: Ethan Li


Currently with 

{code:java}
StormSubmitter.submitTopology(null, ...)
{code}
 
submission will fail:
{code:java}
Exception in thread "main" java.lang.RuntimeException: 
org.apache.storm.thrift.TApplicationException: Internal error processing 
isTopologyNameAllowed
        at 
org.apache.storm.StormSubmitter.topologyNameExists(StormSubmitter.java:438)
        at 
org.apache.storm.StormSubmitter.submitTopologyAs(StormSubmitter.java:247)
        at 
org.apache.storm.StormSubmitter.submitTopology(StormSubmitter.java:206)
        at 
org.apache.storm.StormSubmitter.submitTopologyWithProgressBar(StormSubmitter.java:411)
        at 
org.apache.storm.StormSubmitter.submitTopologyWithProgressBar(StormSubmitter.java:392)
        at 
com.example.SimplifiedTwoCompTopology.main(SimplifiedTwoCompTopology.java:49)
Caused by: org.apache.storm.thrift.TApplicationException: Internal error 
processing isTopologyNameAllowed
        at 
org.apache.storm.thrift.TServiceClient.receiveBase(TServiceClient.java:79)
        at 
org.apache.storm.generated.Nimbus$Client.recv_isTopologyNameAllowed(Nimbus.java:1209)
        at 
org.apache.storm.generated.Nimbus$Client.isTopologyNameAllowed(Nimbus.java:1196)
        at 
org.apache.storm.StormSubmitter.topologyNameExists(StormSubmitter.java:436)
        ... 5 more
{code}

And on nimbus:

{code:java}
2020-04-08 18:38:46.356 o.a.s.t.ProcessFunction pool-34-thread-475 [ERROR] 
Internal error processing isTopologyNameAllowed
java.lang.NullPointerException: null
        at java.util.regex.Matcher.getTextLength(Matcher.java:1283) 
~[?:1.8.0_242]
        at java.util.regex.Matcher.reset(Matcher.java:309) ~[?:1.8.0_242]
        at java.util.regex.Matcher.<init>(Matcher.java:229) ~[?:1.8.0_242]
        at java.util.regex.Pattern.matcher(Pattern.java:1093) ~[?:1.8.0_242]
        at 
org.apache.storm.daemon.nimbus.Nimbus.validateTopologyName(Nimbus.java:1189) 
~[storm-server-2.2.0.y.jar:2.2.0.y]
        at 
org.apache.storm.daemon.nimbus.Nimbus.isTopologyNameAllowed(Nimbus.java:4667) 
~[storm-server-2.2.0.y.jar:2.2.0.y]
        at 
org.apache.storm.generated.Nimbus$Processor$isTopologyNameAllowed.getResult(Nimbus.java:4423)
 ~[storm-client-2.2.0.y.jar:2.2.0.y]
        at 
org.apache.storm.generated.Nimbus$Processor$isTopologyNameAllowed.getResult(Nimbus.java:4402)
 ~[storm-client-2.2.0.y.jar:2.2.0.y]
        at 
org.apache.storm.thrift.ProcessFunction.process(ProcessFunction.java:38) 
[storm-shaded-deps-2.2.0.y.jar:2.2.0.y]
        at 
org.apache.storm.thrift.TBaseProcessor.process(TBaseProcessor.java:39) 
[storm-shaded-deps-2.2.0.y.jar:2.2.0.y]
        at 
org.apache.storm.security.auth.sasl.SaslTransportPlugin$TUGIWrapProcessor.process(SaslTransportPlugin.java:152)
 [storm-client-2.2.0.y
.jar:2.2.0.y]
        at 
org.apache.storm.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:291)
 [storm-shaded-deps-2.2.0.y.jar:2.2.0.y
]
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
[?:1.8.0_242]
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
[?:1.8.0_242]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]
{code}

This is because 
https://github.com/apache/storm/blob/v2.1.0/storm-server/src/main/java/org/apache/storm/daemon/nimbus/Nimbus.java#L1175-L1180

the topology name is null so NullPointerException 

But the error message is not obvious. We should add null check when validating 
topology name and report the error indicating the topology name being null.

 

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to