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

Priority Sorter - Mismatch between client request and server parsing

    • 4.0.1 released Nov 27, 2021

      When trying to set configuration for jobs in "included in a View" mode, saving the configuration will always fail : the JSON sent has a shape different from what the server expects.

      • The client sends the following request
            {
              ...,
              "jobFilter": true|false,
              "jobPattern": "some pattern",
              ...
            }
            
      • The server expects the following request
            {
              ...,
              "jobFilter": {
                "jobPattern": "some pattern"
              },
              ...
            }
            

        or

            {
              ...,
              "jobFilter": null,
              ...
            }
            

      This causes the server to Error 500 upon receiving the request.

      Fixing the request this way using e.g. browser's developer panel works around the issue.

          [JENKINS-66938] Priority Sorter - Mismatch between client request and server parsing

          Martin Jost added a comment -

          Might be duplicated/related to https://issues.jenkins.io/browse/JENKINS-65859

           

          Martin Jost added a comment - Might be duplicated/related to https://issues.jenkins.io/browse/JENKINS-65859  

          Sigitas P added a comment -

          To further expand on ten0 point, we are seeing UI making 'wrong' requests as well. 

          In particular when saving for the second time configuration 'stapler-class' and  '$class' are sent incorrectly. 
          This is fairly easy to replicate. 
          1. Create 2 or more job groups (having single one works every time)
          2. Save job groups 
          3. Go back to Job Priorities tab
          4. Without any further changes click save 
          5. This will produce you an error with server response 500

          The key difference between 2 and 4 is how the request to the server looks like. Sample JSON POST request added with 2 requests with same exact data on the Job priorities tab, while the requests looked different. first_post(step_1).jsonsecond_post(step_4).json

          Jenkins version: 2.303.1
          PrioritySorter version: 4.0.0

          Sigitas P added a comment - To further expand on ten0  point, we are seeing UI making 'wrong' requests as well.  In particular when saving for the second time configuration 'stapler-class' and  '$class' are sent incorrectly.  This is fairly easy to replicate.  1. Create 2 or more job groups (having single one works every time) 2. Save job groups  3. Go back to Job Priorities tab 4. Without any further changes click save  5. This will produce you an error with server response 500 The key difference between 2 and 4 is how the request to the server looks like. Sample JSON POST request added with 2 requests with same exact data on the Job priorities tab, while the requests looked different.  first_post(step_1).json second_post(step_4).json Jenkins version: 2.303.1 PrioritySorter version: 4.0.0

          Mark Waite added a comment - - edited

          I duplicated the problem with Jenkins 2.263.4 and plugin version 4.0.0. I was not able to duplicate the problem with plugin versions 3.6.0 or 3.5.1. Will need more bisecting to understand the change between 4.0.0 and 3.6.0.

          Mark Waite added a comment - - edited I duplicated the problem with Jenkins 2.263.4 and plugin version 4.0.0. I was not able to duplicate the problem with plugin versions 3.6.0 or 3.5.1. Will need more bisecting to understand the change between 4.0.0 and 3.6.0.

          Mark Waite added a comment -

          https://ci.jenkins.io/job/Plugins/job/priority-sorter-plugin/job/PR-88/ provides a prototype of the proposed fix. I'm not comfortable that the proposed fix will resolve the issue in all cases. I'd love to have others review it interactively and through the code.

          Mark Waite added a comment - https://ci.jenkins.io/job/Plugins/job/priority-sorter-plugin/job/PR-88/ provides a prototype of the proposed fix. I'm not comfortable that the proposed fix will resolve the issue in all cases. I'd love to have others review it interactively and through the code.

            markewaite Mark Waite
            ten0 Thomas Bessou
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: