[jira] [Commented] (NIFI-883) HandleHttpRequest starts a web server in the OnScheduled method but should start it in onTrigger

2015-11-02 Thread Mark Payne (JIRA)

[ 
https://issues.apache.org/jira/browse/NIFI-883?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14985417#comment-14985417
 ] 

Mark Payne commented on NIFI-883:
-

[~JPercivall] - ahh, much better! :) Rebuilt and verified contrib-check is 
good. Ran erroneous and "good" tests again and got the expected behavior. 
Nicely done! Merged and closed ticket.

> 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_added_yield.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)


[jira] [Commented] (NIFI-883) HandleHttpRequest starts a web server in the OnScheduled method but should start it in onTrigger

2015-11-02 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/NIFI-883?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14985414#comment-14985414
 ] 

ASF subversion and git services commented on NIFI-883:
--

Commit 2ae49026e898ef9ea154990f4d3a5da3ee8d8129 in nifi's branch 
refs/heads/master from [~JPercivall]
[ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=2ae4902 ]

NIFI-883 Fixing issue HandleHttpRequest had with PrimaryNodeOnly scheduling

Signed-off-by: Mark Payne 


> 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_added_yield.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)


[jira] [Commented] (NIFI-883) HandleHttpRequest starts a web server in the OnScheduled method but should start it in onTrigger

2015-11-01 Thread Mark Payne (JIRA)

[ 
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)


[jira] [Commented] (NIFI-883) HandleHttpRequest starts a web server in the OnScheduled method but should start it in onTrigger

2015-10-27 Thread Mark Payne (JIRA)

[ 
https://issues.apache.org/jira/browse/NIFI-883?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14976532#comment-14976532
 ] 

Mark Payne commented on NIFI-883:
-

Hey Joe - reading through the code now. I think we can simplify the locking in 
this Processor quite a bit. If we just mark the initializeServer() method as 
synchronized, then we don't really need the lock at all. the 'initialized' flag 
already is an AtomicBoolean, and access to it is thread-safe in the way that it 
is being used. Since this variable is checked within the initializeServer() 
method, if we just make that method synchronized, then we ensure that no two 
threads will be competing to perform the action first.

> 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
>
>
> 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)