Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-48563

Agent Labels missing in GUI

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: core
    • Labels:
      None
    • Environment:
      Jenkins LTS 2.60.3-cb-1
    • Similar Issues:

      Description

      Jobs are not getting assigned to labeled nodes. While digging into this, we discovered some cases where the node labels are not appearing on the node status page. When looking at the node config page, the labels do exist.

      • Agent is configured as (slave-it0400-config.jpg)
      • After saving the agent configration, assigned labels are not being showed on the slave status page (slave-it0400-status.jpg)

      But labels are actually serialized in the agent `config.xml` (slave-it0400-configfile.xml)

      Browse details as follows:

      Browser
      =======
      
        * Screen size: 2560x1440
        * User Agent
            - Type:     Browser
            - Name:     Chrome
            - Family:   CHROME
            - Producer: Google Inc.
            - Version:  62.0.3202.94
            - Raw:      `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36`
        * Operating System
            - Name:     Windows
            - Family:   WINDOWS
            - Producer: Microsoft Corporation.
            - Version:  10.0
      

      HAR file seems normal in terms of HTTP response codes (buildmaster-alpha.devsnc.com-slave-it0400.har)

        Attachments

          Issue Links

            Activity

            Hide
            allan_burdajewicz Allan BURDAJEWICZ added a comment -

            Found interesting exception in the logs:

            2017-11-27 18:04:23.501+0000 [id=11338]	WARNING	h.ExpressionFactory2$JexlExpression#evaluate: Caught exception evaluating: it.node.labelCloud in /computer/my-agent/. Reason: java.lang.reflect.InvocationTargetException
            java.lang.ClassCastException: hudson.model.labels.LabelExpression$And cannot be cast to hudson.model.labels.LabelAtom
            	at jenkins.model.Jenkins.getLabelAtom(Jenkins.java:2003)
            	at hudson.model.labels.LabelAtom.get(LabelAtom.java:235)
            	at hudson.model.labels.LabelExpressionParser.term6(LabelExpressionParser.java:208)
            	at hudson.model.labels.LabelExpressionParser.term5(LabelExpressionParser.java:164)
            	at hudson.model.labels.LabelExpressionParser.term4(LabelExpressionParser.java:136)
            	at hudson.model.labels.LabelExpressionParser.term3(LabelExpressionParser.java:113)
            	at hudson.model.labels.LabelExpressionParser.term2(LabelExpressionParser.java:83)
            	at hudson.model.labels.LabelExpressionParser.term1(LabelExpressionParser.java:60)
            	at hudson.model.labels.LabelExpressionParser.expr(LabelExpressionParser.java:50)
            	at hudson.model.Label.parseExpression(Label.java:611)
            	at hudson.model.AbstractProject.getAssignedLabelString(AbstractProject.java:425)
            	at hudson.model.Label.getTiedJobCount(Label.java:410)
            	at hudson.model.Node$1.weight(Node.java:284)
            	at hudson.model.Node$1.weight(Node.java:282)
            	at hudson.util.TagCloud.<init>(TagCloud.java:73)
            	at hudson.model.Node.getLabelCloud(Node.java:282)
            Caused: java.lang.reflect.InvocationTargetException
            

            This points to an offending label expression in an AbstractProject: https://github.com/jenkinsci/jenkins/blob/jenkins-2.60.3/core/src/main/java/hudson/model/Label.java#L410

            Show
            allan_burdajewicz Allan BURDAJEWICZ added a comment - Found interesting exception in the logs: 2017-11-27 18:04:23.501+0000 [id=11338] WARNING h.ExpressionFactory2$JexlExpression#evaluate: Caught exception evaluating: it.node.labelCloud in /computer/my-agent/. Reason: java.lang.reflect.InvocationTargetException java.lang.ClassCastException: hudson.model.labels.LabelExpression$And cannot be cast to hudson.model.labels.LabelAtom at jenkins.model.Jenkins.getLabelAtom(Jenkins.java:2003) at hudson.model.labels.LabelAtom.get(LabelAtom.java:235) at hudson.model.labels.LabelExpressionParser.term6(LabelExpressionParser.java:208) at hudson.model.labels.LabelExpressionParser.term5(LabelExpressionParser.java:164) at hudson.model.labels.LabelExpressionParser.term4(LabelExpressionParser.java:136) at hudson.model.labels.LabelExpressionParser.term3(LabelExpressionParser.java:113) at hudson.model.labels.LabelExpressionParser.term2(LabelExpressionParser.java:83) at hudson.model.labels.LabelExpressionParser.term1(LabelExpressionParser.java:60) at hudson.model.labels.LabelExpressionParser.expr(LabelExpressionParser.java:50) at hudson.model.Label.parseExpression(Label.java:611) at hudson.model.AbstractProject.getAssignedLabelString(AbstractProject.java:425) at hudson.model.Label.getTiedJobCount(Label.java:410) at hudson.model.Node$1.weight(Node.java:284) at hudson.model.Node$1.weight(Node.java:282) at hudson.util.TagCloud.<init>(TagCloud.java:73) at hudson.model.Node.getLabelCloud(Node.java:282) Caused: java.lang.reflect.InvocationTargetException This points to an offending label expression in an AbstractProject: https://github.com/jenkinsci/jenkins/blob/jenkins-2.60.3/core/src/main/java/hudson/model/Label.java#L410
            Hide
            allan_burdajewicz Allan BURDAJEWICZ added a comment -

            A way to reproduce this issue is to:

            • create a simple node with labels, for example dedicated osx
            • Go to the nodes status page: the "Labels" section displays each label with a link to it
            • create a freestyle project, tick "Restrict where this project can be run" and use the label expression "dedicated||master" - including the double quotes!
            • Go to the nodes status page: the "Labels" section displays no labels anymore

            Note that when you enter the label with double quotes "dedicated||master" in the project, you see a exception in the UI: classcastexception-abstractproject.png

            Show
            allan_burdajewicz Allan BURDAJEWICZ added a comment - A way to reproduce this issue is to: create a simple node with labels, for example dedicated osx Go to the nodes status page: the "Labels" section displays each label with a link to it create a freestyle project, tick "Restrict where this project can be run" and use the label expression "dedicated||master" - including the double quotes! Go to the nodes status page: the "Labels" section displays no labels anymore Note that when you enter the label with double quotes "dedicated||master" in the project, you see a exception in the UI: classcastexception-abstractproject.png
            Hide
            danielbeck Daniel Beck added a comment -

            The reproduction steps indicate this is basically just JENKINS-22975. Spaces make the problem go away here as well.

            Not 100% certain though (and my analysis related to the legixal nondeterminism in JENKINS-16728 may well be wrong if other expressions are affected as well).

            Show
            danielbeck Daniel Beck added a comment - The reproduction steps indicate this is basically just JENKINS-22975 . Spaces make the problem go away here as well. Not 100% certain though (and my analysis related to the legixal nondeterminism in JENKINS-16728 may well be wrong if other expressions are affected as well).
            Hide
            danielbeck Daniel Beck added a comment -

            Seems likely to me that the handling of STRINGLITERAL, specifically the call to QuotedStringTokenizer.unquote, is to blame here. Perhaps nobody considered that stripping quotes will result in a non-atomic label expression?

            Show
            danielbeck Daniel Beck added a comment - Seems likely to me that the handling of STRINGLITERAL , specifically the call to QuotedStringTokenizer.unquote , is to blame here. Perhaps nobody considered that stripping quotes will result in a non-atomic label expression?
            Hide
            allan_burdajewicz Allan BURDAJEWICZ added a comment -

            Note that when reproducing, I noticed that the labels in the node status page are not missing immediately after adding the faulty label to the freestyle project. Even when reloading the page. Reloading the page after some time exposes it though. I am not too sure why.
            But the double quotes are definitely the culprit.

            Show
            allan_burdajewicz Allan BURDAJEWICZ added a comment - Note that when reproducing, I noticed that the labels in the node status page are not missing immediately after adding the faulty label to the freestyle project. Even when reloading the page. Reloading the page after some time exposes it though. I am not too sure why. But the double quotes are definitely the culprit.

              People

              • Assignee:
                Unassigned
                Reporter:
                carlosrodlop Carlos Rodríguez López
              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated: