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

Nathan Gough commented on NIFI-4194:
------------------------------------

[~tony0918]


Hi Tony,

This issue was fixed during an upgrade to the OkHttp dependency from v2.7.1 in 
NiFi v1.3.0, to v3.8.1 in NiFi v1.4.0. Refactoring for this upgrade changed the 
way the HostnameVerifier is used by the InvokeHTTP processor. I have verified 
this by building NiFi v1.3.0 and experienced the exception:

 

!Screen Shot 2018-07-12 at 3.29.50 PM.png!

 

Which was the rectified by building NiFi v1.6.0:

!Screen Shot 2018-07-12 at 4.39.27 PM.png!

The specific change can be found here:

NiFi v1.3.0 and earlier: 

[https://github.com/apache/nifi/blob/ddb73612bd1512d8b2151b81f9aa40811bca2aaa/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java#L534]

NiFi v1.4.0 onwards: 

[https://github.com/apache/nifi/blob/4dd3495c7724657273d5d1ea32b3179a4c318e44/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java#L637]

(NiFi v1.6.0 for good measure:

[https://github.com/apache/nifi/blob/f8466cb16d6723ddc3bf5f0e7f8ce8a47d27cbe5/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/InvokeHTTP.java#L612]
 )

 

> NullPointerException in InvokeHTTP processor when trusted hostname property 
> is used
> -----------------------------------------------------------------------------------
>
>                 Key: NIFI-4194
>                 URL: https://issues.apache.org/jira/browse/NIFI-4194
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: 1.3.0
>            Reporter: Andy LoPresto
>            Assignee: Nathan Gough
>            Priority: Major
>              Labels: hostname, okhttp, security, tls
>         Attachments: Screen Shot 2018-07-12 at 3.29.50 PM.png, Screen Shot 
> 2018-07-12 at 4.39.27 PM.png, flow_20170717-192339_trusted_hostname.xml
>
>
> When a user configures the {{InvokeHTTP}} processor with HTTPS (using an 
> {{SSLContextService}}) and populates the {{trustedHostname}} property, the 
> processor will throw a {{NullPointerException}} because the OkHttp client 
> does not have a valid {{HostnameVerifier}} configured when the 
> {{@OnScheduled}} method is called and that verifier is delegated to the 
> processor. This results in the stacktrace below:
> {code}
> 2017-07-17 19:15:49,341 ERROR [Timer-Driven Process Thread-6] 
> o.a.nifi.processors.standard.InvokeHTTP 
> InvokeHTTP[id=53784003-015d-1000-ffb0-e07173729c9c] Routing to Failure due to 
> exception: java.lang.NullPointerException: java.lang.NullPointerException
> java.lang.NullPointerException: null
>       at 
> org.apache.nifi.processors.standard.InvokeHTTP$OverrideHostnameVerifier.verify(InvokeHTTP.java:1050)
>       at 
> com.squareup.okhttp.internal.io.RealConnection.connectTls(RealConnection.java:192)
>       at 
> com.squareup.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:145)
>       at 
> com.squareup.okhttp.internal.io.RealConnection.connect(RealConnection.java:108)
>       at 
> com.squareup.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:184)
>       at 
> com.squareup.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126)
>       at 
> com.squareup.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95)
>       at 
> com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:283)
>       at 
> com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224)
>       at com.squareup.okhttp.Call.getResponse(Call.java:286)
>       at 
> com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:243)
>       at 
> com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:205)
>       at com.squareup.okhttp.Call.execute(Call.java:80)
>       at 
> org.apache.nifi.processors.standard.InvokeHTTP.onTrigger(InvokeHTTP.java:630)
>       at 
> org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
>       at 
> org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1120)
>       at 
> org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:147)
>       at 
> org.apache.nifi.controller.tasks.ContinuallyRunProcessorTask.call(ContinuallyRunProcessorTask.java:47)
>       at 
> org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:132)
>       at 
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>       at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
>       at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
>       at 
> java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
>       at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>       at java.lang.Thread.run(Thread.java:745)
> {code}
> When that method is invoked, the existence of the {{HostnameVerifier}} should 
> be checked before it is provided to the {{OverrideHostnameVerifier}}, and a 
> default value of {{OkHostnameVerifier.INSTANCE}} (public static singleton) 
> should be provided if none is available.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to