[
https://issues.apache.org/jira/browse/NIFI-883?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14984541#comment-14984541
]
Mark Payne commented on NIFI-883:
---------------------------------
[~JPercivall] - i tested this out, and all looks good on a sunny day.
Unfortunately, though, if I configure the processor to run on port 80 (which I
don't have permissions to do if i don't run as root), then the processor throws
an Exception, catches it, and returns. So this then happens again. And again.
And within a few milliseconds, I start seeing thousands of these in the logs:
{code}
2015-11-01 15:47:41,463 WARN [Timer-Driven Process Thread-6]
o.e.j.util.component.AbstractLifeCycle FAILED
org.eclipse.jetty.server.Server@6f48b023: java.lang.OutOfMemoryError: unable to
create new native thread
java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method) [na:1.8.0_60]
at java.lang.Thread.start(Thread.java:714) [na:1.8.0_60]
at
org.eclipse.jetty.server.ShutdownMonitor.start(ShutdownMonitor.java:511)
~[jetty-server-9.2.11.v20150529.jar:9.2.11.v20150529]
at org.eclipse.jetty.server.Server.doStart(Server.java:325)
~[jetty-server-9.2.11.v20150529.jar:9.2.11.v20150529]
at
org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
~[jetty-util-9.2.11.v20150529.jar:9.2.11.v20150529]
at
org.apache.nifi.processors.standard.HandleHttpRequest.initializeServer(HandleHttpRequest.java:412)
[nifi-standard-processors-0.3.1-SNAPSHOT.jar:0.3.1-SNAPSHOT]
at
org.apache.nifi.processors.standard.HandleHttpRequest.onTrigger(HandleHttpRequest.java:469)
[nifi-standard-processors-0.3.1-SNAPSHOT.jar:0.3.1-SNAPSHOT]
at
org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
[nifi-api-0.3.1-SNAPSHOT.jar:0.3.1-SNAPSHOT]
at
org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1134)
[nifi-framework-core-0.3.1-SNAPSHOT.jar:0.3.1-SNAPSHOT]
at
org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:127)
[nifi-framework-core-0.3.1-SNAPSHOT.jar:0.3.1-SNAPSHOT]
at
org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:49)
[nifi-framework-core-0.3.1-SNAPSHOT.jar:0.3.1-SNAPSHOT]
at
org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:119)
[nifi-framework-core-0.3.1-SNAPSHOT.jar:0.3.1-SNAPSHOT]
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[na:1.8.0_60]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
[na:1.8.0_60]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
[na:1.8.0_60]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
[na:1.8.0_60]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[na:1.8.0_60]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[na:1.8.0_60]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_60]
{code}
I think this is easily solved, though, by calling context.yield() whenever you
catch an Exception during server initialization.
> HandleHttpRequest starts a web server in the OnScheduled method but should
> start it in onTrigger
> ------------------------------------------------------------------------------------------------
>
> Key: NIFI-883
> URL: https://issues.apache.org/jira/browse/NIFI-883
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Reporter: Mark Payne
> Assignee: Joseph Percivall
> Labels: beginner, newbie
> Fix For: 0.4.0
>
> Attachments: HttpRequestAndResponseTester.xml, NIFI-883.patch,
> NIFI-883_removed_lock.patch
>
>
> When HandleHttpRequest is scheduled, it creates an embedded jetty web server
> and starts it. Unfortunately, if this is run in a clustered environment and
> configured to run on Primary Node Only, all nodes still start the web server.
> This is very confusing if setting the Hostname property, as other nodes will
> complain.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)