You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by "Kevin Risden (Jira)" <ji...@apache.org> on 2019/08/26 17:20:00 UTC

[jira] [Commented] (KNOX-1995) If a rule doesn't match, shouldn't ERROR and return null

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

Kevin Risden commented on KNOX-1995:
------------------------------------

Here is the specific case of YARNUIv2 that this comes up in. From gateway.log:

{code:java}
2019-08-21 11:42:52,955 ERROR knox.gateway (UrlRewriteProcessor.java:rewrite(166)) - Failed to rewrite URL: HTTP_ONLY, direction: OUT via rule: YARNUIV2/yarnuiv2/outbound/timeline, status: FAILURE
2019-08-21 11:42:52,955 ERROR knox.gateway (JsonFilterReader.java:filterStreamValue(547)) - Failed to filter value HTTP_ONLY, rule YARNUIV2/yarnuiv2/outbound/timeline: java.lang.NullPointerException
{code}

Here is the rewrite rule combination:

{code:java}
<rule dir="IN" name="YARNUIV2/yarnuiv2/outbound/timeline">
    <match pattern="{host}:{port}"/>
    <rewrite template="{$frontend[url]}/yarnuiv2/timeline?{host}?{port}"/>
  </rule>
  
  <filter name="YARNUIV2/yarnuiv2/outbound/query">
    <content type="*/json">
      <apply path="$.property.value" rule="YARNUIV2/yarnuiv2/outbound/timeline"/>
    </content>
  </filter>
{code}

And the error message comes from the following HTTP request:

{code:java}
curl -k -i -u <user:password> -L --location-trusted  -H 'Accept: application/json' "https://<Knox IP>:8443/gateway/ui/yarnuiv2/conf?name=yarn.http.policy"

{"property":{"key":"yarn.http.policy","value":"HTTP_ONLY","isFinal":false,"resource":"yarn-site.xml"}}
{code}

The value ends up being "HTTP_ONLY" and then the rewrite filter can't handle the explicit rule matching.

> If a rule doesn't match, shouldn't ERROR and return null
> --------------------------------------------------------
>
>                 Key: KNOX-1995
>                 URL: https://issues.apache.org/jira/browse/KNOX-1995
>             Project: Apache Knox
>          Issue Type: Bug
>            Reporter: Kevin Risden
>            Assignee: Kevin Risden
>            Priority: Major
>             Fix For: 1.4.0
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Currently when an explicit rule doesn't match, we are throwing an ERROR and returning null. This causes NPEs later in the flow and instead should match the behavior of a non explicit rule. If the rule doesn't match, log only at DEBUG and return the original input.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)