• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • core
    • None
    • Jenkins LTS 2.60.3-cb-1

      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)

          [JENKINS-48563] Agent Labels missing in GUI

          Oleg Nenashev added a comment -

          Remoting does not manage labels, it's the Jenkins Core functionality

          Oleg Nenashev added a comment - Remoting does not manage labels, it's the Jenkins Core functionality

          Daniel Beck added a comment -

          Daniel Beck added a comment - carlosrodlop ping

          Carlos Rodríguez López added a comment - danielbeck yes?

          Daniel Beck added a comment -

          carlosrodlop

          IIRC agent labels are updated in background threads. Check the thread dump to see whether there's something delayed there.

          Daniel Beck added a comment - carlosrodlop IIRC agent labels are updated in background threads. Check the thread dump to see whether there's something delayed there.

          danielbeck I opened this issue on behalf of jnewblanc.

          jnewblanc - Can you please provide the requested input when the issue is exposed? The output from Required Data: CJP/CJT Hang Issue On Linux might be really useful in this context.

          Carlos Rodríguez López added a comment - danielbeck I opened this issue on behalf of jnewblanc . jnewblanc - Can you please provide the requested input when the issue is exposed? The output from Required Data: CJP/CJT Hang Issue On Linux might be really useful in this context.

          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

          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

          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

          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

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

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

          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?

          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?

          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.

          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.

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

              Created:
              Updated: