[ZBX-10880] JSON-RPC batch aren't working anymore in 3.0 Created: 2016 Jun 06  Updated: 2017 May 30  Resolved: 2016 Jul 18

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: API (A)
Affects Version/s: 3.0.3
Fix Version/s: 3.0.4rc1, 3.2.0alpha1

Type: Incident report Priority: Minor
Reporter: Julien Roncaglia Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: json-rpc, regression
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

JSON-RPC support request batching (6. Batch in the specification) and we were using it with Zabbix 2 (2.0.3 exactly) without problems. Since we upgrated to 3.0.3 zabbix returns JSON-rpc version is not specified when we send them.

I didn't see any notes about this behavior in Zabbix documentation, and batching doesn't seem optional in the JSON-RPC specification, did I miss something ?

Request:

[
  {
    "jsonrpc":"2.0",
    "method":"trigger.get",
    "auth":"...",
    "params":
    {
        "output":"extend",
        "expandData":true,
        "expandDescription":true,
        "preservekeys":true,
        "filter":{"triggerid":[]}},
        "id":0
    }
]

Response:

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32600,
    "message": "Invalid Request.",
    "data": "JSON-rpc version is not specified."
  },
  "id": null
}


 Comments   
Comment by vitalijs.cemeris (Inactive) [ 2016 Jun 06 ]

option filter has extra char

"filter":{"triggerid":[] } },

Comment by Julien Roncaglia [ 2016 Jun 06 ]

Yes that's me trying and failing to do manual indenting for the JIRA . Noticed it after posting but cant' seem to be able to edit my post.

My test to confirm that batch didn't work is simply to take any single request and add brackets around.

I changed our internal tool that query zabbix to disable batching and it's working correctly (Same messages, just not batched anymore).

Comment by Julien Roncaglia [ 2016 Jun 06 ]

Also "option filter has extra char" doesn't really have an extra char, it's just not correctly indented.

Correct indentation, not done by hand :

[
    {
        "jsonrpc": "2.0",
        "method": "trigger.get",
        "auth": "...",
        "params": {
            "output": "extend",
            "expandData": true,
            "expandDescription": true,
            "preservekeys": true,
            "filter": {
                "triggerid": []
            }
        },
        "id": 0
    }
]

(But the exact query doesn't seem to matter anyway, no batch works whatever the query)

Comment by vitalijs.cemeris (Inactive) [ 2016 Jun 07 ]

This is a regression from ZBX-7781

Comment by vitalijs.cemeris (Inactive) [ 2016 Jun 07 ]

(1) No translation string changes.

gunarspujats CLOSED

Comment by vitalijs.cemeris (Inactive) [ 2016 Jun 07 ]

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-10880

Comment by vitalijs.cemeris (Inactive) [ 2016 Jun 09 ]

(2) Create test for execute() method of class CJsonRpc
RESOLVED in r60578, r60579

gunarspujats CLOSED

Comment by vitalijs.cemeris (Inactive) [ 2016 Jun 09 ]

(3) Incorrect response error of execute() method.
RESOLVED in r60580, r60586, r60614

gunarspujats CLOSED

Comment by Gunars Pujats (Inactive) [ 2016 Jun 20 ]

(4) Coding style

include/classes/json/CJson.php
1. :85, 86 - constants duplicate existing PHP constants
2. :98 - variable description missing
3. :272 - function description missing

tests/unit/include/classes/core/CJsonRpcTest.php
4. :34, 39, 48 - description missing
5. missing valid tests

vitalijs.cemeris RESOLVED in r60701, r60707, r60708, r60718, r60719, r60720

gunarspujats
tests/unit/include/classes/core/CJsonRpcTest.php
1. :59, 75 - incorrect indentation
2. :70 - unused variable $response
3. :139 - unused variable $key

include/classes/core/CJsonRpc.php
4. :82 - too complex return statement

vitalijs.cemeris RESOLVED in r60752

gunarspujats CLOSED

Comment by vitalijs.cemeris (Inactive) [ 2016 Jun 27 ]

(5) error message for '5', '0' should be same. RESOLVED in r60748, r60775

gunarspujats CLOSED

Comment by Gunars Pujats (Inactive) [ 2016 Jun 28 ]

Tested

Comment by vitalijs.cemeris (Inactive) [ 2016 Jun 28 ]

Fixed in:

  • pre-3.0.4rc1 r60783
  • pre-3.1.0 r60784
Comment by vitalijs.cemeris (Inactive) [ 2016 Jun 29 ]

(6) API documentation:

sasha CLOSED

Comment by richlv [ 2016 Sep 20 ]

this broke the api - see ZBX-11244

Generated at Sat Apr 27 04:34:44 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.