Ad Widget

Collapse

Concurrency bug in Zabbix, first to finish kills other standalone clients session.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jnunez
    Junior Member
    • Apr 2020
    • 3

    #1

    Concurrency bug in Zabbix, first to finish kills other standalone clients session.

    Hello,


    I have a set of processes asking Zabbix historical data through the JSON-RPC API. The queries are short lived (asking only 7 days back of worth data) but for some reason when one of them finishes first the others crash with the following error (if the session is still not closed):

    Code:
     pyzabbix.api.ZabbixAPIException: {'code': -32500, 'message': 'Application error.', 'data': 'SQL statement execution has failed "DELETE FROM sessions WHERE status=\'1\' AND userid=\'71\'"', 'json': "{'jsonrpc': '2.0', 'method': 'user.logout', 'params': {}, 'id': '1', 'auth': '********'}"}

    I do share the same credentials among the 4 running instances of the script, the error seems to indicate than the login session ID is not unique and is only one session per user, therefore if one of the scripts finishes soon the others will have their session closed.

    Has anybody else experienced this issue? Maybe I'm not logging up right (python snipped code):

    Code:
     def get_zabbix_api(self):
    """
    Get a Zabbix session
    :return: ZabbixAPI instance
    """
    return ZabbixAPI(url=self.url, user=self.user, password=self.password)
    And my logout wrapper after every call:

    Code:
     finally:
    if zapi is not None:
    zapi.user.logout()

    I'm using Zabbix 5.0.

    Thanks in advance,

    --Jose


  • jnunez
    Junior Member
    • Apr 2020
    • 3

    #2
    Opened a formal bug request: https://support.zabbix.com/browse/ZBX-19826

    Comment

    Working...