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

George Liaw edited comment on TEZ-3488 at 11/2/16 5:27 PM:
-----------------------------------------------------------

[~Sreenath] [~jeagles]

What I meant is that if you look at this try catch for setCorsHeaders(), you 
can do a check for default ports and strip them:
https://github.com/apache/tez/blob/master/tez-dag/src/main/java/org/apache/tez/dag/app/web/AMWebController.java#L127

Could be rewritten as:
{code:java}
    try {
        URL url = new URL(historyUrlBase);
        if (url.getPort() == 80 || url.getPort() == 443) {
            origin = url.getProtocol() + "://" + url.getHost();
        } else {
            origin = url.getProtocol() + "://" + url.getHost() + ":" + 
url.getPort();
        }
    } catch (MalformedURLException e) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Invalid url set for tez history url base: " + 
historyUrlBase, e);
        }
    }
{code}

The documentation should also be updated to let users know that 
tez.tez-ui.history-url.base is being used for Application Master CORS header 
and whatever the intended behavior becomes regarding default ports (whether the 
user can leave default ports 80/443 explicitly set or if they should remove 
default ports from the setting)


was (Author: gliaw):
[~Sreenath] [~jeagles]

What I meant is that if you look at this try catch for setCorsHeaders(), you 
can do a check for default ports and strip them:
https://github.com/apache/tez/blob/master/tez-dag/src/main/java/org/apache/tez/dag/app/web/AMWebController.java#L127

Could be rewritten as:
{code:java}
    try {
        URL url = new URL(historyUrlBase);
        if (url.getPort() == 80 || url.getPort() == 443) {
            origin = url.getProtocol() + "://" + url.getHost();
        } else {
            origin = url.getProtocol() + "://" + url.getHost() + ":" + 
url.getPort();
        }
    } catch (MalformedURLException e) {
        if (LOG.isDebugEnabled()) {
            LOG.debug("Invalid url set for tez history url base: " + 
historyUrlBase, e);
        }
    }
{code}

> Tez UI Vertex 404
> -----------------
>
>                 Key: TEZ-3488
>                 URL: https://issues.apache.org/jira/browse/TEZ-3488
>             Project: Apache Tez
>          Issue Type: Bug
>    Affects Versions: 0.8.4
>            Reporter: George Liaw
>
> When we're trying to view vertices for a running job, the Vertex page will 
> show a 404 error saying:
> "Could not retrieve expected data from @ <url>"
> And the Vertex Counter page will show:
> "Counters unavailable"
> and
> "Error code: Unknown, message: Resource Manager (RM) out of reach. Either 
> it's down or CORS is not enabled"
> The RMs are up and CORS is enabled. If we go to the displayed url, we get the 
> expected XML with the application info. When the DAG finishes running, those 
> errors go away and the pages display fine. Any idea what's going on here?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to