markap14 commented on a change in pull request #4356:
URL: https://github.com/apache/nifi/pull/4356#discussion_r444222483



##########
File path: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ListenHTTP.java
##########
@@ -373,6 +386,14 @@ public void createHttpServer(final ProcessContext context) 
throws Exception {
 
     @Override
     public void onTrigger(final ProcessContext context, final 
ProcessSessionFactory sessionFactory) {
+        try {
+            if (!initialized.get()) {

Review comment:
       If the processor is scheduled with multiple threads, we could have 
multiple threads entering `createHttpServerFromService` simultaneously. Each 
can then create a new server, resulting in multiple Jetty Servers being created 
and started but only one ever getting stored as `this.server` so we'd be 
leaking the server resource. It's important that the method itself be marked as 
`synchronized` or that a `synchronized` block is used here to guard against 
this.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to