[ZBX-19705] User Macros with Macro as Context on VMware Trigger Prototype Causes Assertion Created: 2021 Jul 20  Updated: 2021 Jul 21  Resolved: 2021 Jul 21

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 5.4.2
Fix Version/s: None

Type: Problem report Priority: Trivial
Reporter: Shane Assignee: Aleksey Volodin
Resolution: Cannot Reproduce Votes: 0
Labels: bug
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 20.04
Zabbix Server 5.4.2
PostgreSQL 12.7
TimescaleDB 1.7.5


Attachments: PNG File 5.0.12.png     PNG File 638e4d2b94b2a54a7dccd08881eb42de.png     PNG File After update.png     PNG File image-2021-07-21-09-00-20-787.png     XML File vmware_guest_macro_context.xml     File vmware_guest_macros_context.yaml    

 Description   

Steps to reproduce:

  1. Import vmware_guest_macro_context.xmlto Zabbix Server running version 5.0.12
    Or create a trigger protoype using and LLD macro #FSNAME in the macro context (modelled off the default Windows filesystem discovery template).
  2. Upgrade from 5.0.12 to 5.4.2
  3. The server  crashes with "Invalid trigger" and "zbx_db_rolback: Assertion '0' failed"

Or

  1. Attempt to add a trigger prototype using an LLD macro #FSNAME in the macro context, eg: {$VFS.FS.PUSED.MAX.MAJ:" {#FSNAME}"}
    # A DB error is displayed: "Cannot update trigger prototype"

    Result:

    When upgrading with such template/trigger prototype, Zabbix Server starts and crashes, producing an error like:
     72661:20210713:210551.873 Invalid trigger "VMware: C:\Program Files\Citrix\PvsVm\Service\PersistedData\: Disk space is low (used > {$VFS.FS.PUSED.MAX.WARN:"C:\ProgramFiles\Citrix\PvsVm\Service\PersistedData\"}%) on {HOST.NAME}" expression: invalid token starting with "{$VFS.FS.PUSED.MAX.WARN:"C:\Program Files\Citrix\PvsVm\Service\PersistedData\"} and (({2}-{3})<10G or {4}<1d)"


    # Then:

    The DB contains all these triggers as state "Unknown" after upgrade.

    Zabbix Server starts and runs fine after deleting all these triggers (maybe not required) and disabling the trigger prototypes affected, then kill -9'ing/starting the service.

    When trying to add such trigger to Zabbix Server running version 5.4.2, a database error is displayed via the frontend :
    Cannot update trigger prototype

    
    

    pg_query(): Query failed: ERROR: deadlock detectedDETAIL: Process 757841 waits for ShareLock on transaction 353753080; blocked by process 617147.Process 617147 waits for ShareLock on transaction 353753075; blocked by process 757841.HINT: See server log for query details.CONTEXT: while updating tuple (2378,16) in relation "triggers" [trigger_prototypes.php:345 → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → CTriggerPrototype->update() → CTriggerGeneral->inherit() → CTriggerGeneral->updateReal() → DB::update() → DBexecute() → pg_query() in include/db.inc.php:349]Error in query [UPDATE triggers SET expression='{541553}>{$VFS.FS.PUSED.MAX.WARN:"{#FSNAME}

    "} and ((

    {541554}-{541555})<10G or {541556}<1d)',recovery_expression='',uuid='',description='VMware: {#FSNAME}: Disk space is very low (used > {$VFS.FS.PUSED.MAX.WARN:"{#FSNAME}"}%) on {HOST.NAME}' WHERE triggerid='242563'] [ERROR: deadlock detectedDETAIL: Process 757841 waits for ShareLock on transaction 353753080; blocked by process 617147.Process 617147 waits for ShareLock on transaction 353753075; blocked by process 757841.HINT: See server log for query details.CONTEXT: while updating tuple (2378,16) in relation "triggers"]SQL statement execution has failed "UPDATE triggers SET expression='{541553}>{$VFS.FS.PUSED.MAX.WARN:"{#FSNAME}"} and (({541554}

    -

    {541555}

    )<10G or

    {541556}

    <1d)',recovery_expression='',uuid='',description='VMware:

    {#FSNAME}: Disk space is very low (used > {$VFS.FS.PUSED.MAX.WARN:"{#FSNAME}

    "}%) on

    {HOST.NAME}

    ' WHERE triggerid='242563'".

    
    

Expected:
Zabbix should support using an LLD macro in the macro context of VMware trigger prototypes, as supported with Windows.



 Comments   
Comment by Shane [ 2021 Jul 20 ]

Apologies for the formatting.. It looked fine before I submitted it. 

Comment by Aleksey Volodin [ 2021 Jul 20 ]

Possible duplicate https://support.zabbix.com/browse/ZBX-19585

Comment by Aleksey Volodin [ 2021 Jul 20 ]

We unfortunately could not reproduced this issue.

In Zabbix 5.0.12 we created trigger prototype as you mention:

After update to 5.4.2 Expression was successful update to

And it similar to expression created in 5.4.2 directly.

Comment by Shane [ 2021 Jul 21 ]

Okay, I think this is only an issue for discovered VM's, for example hosts discovered by the 'Discover VMware VMs' template, where the template and group is locked.

If I clone a host discovered by this template, then link my template containing the problematic macro context, the issue is not present.

Generated at Mon Jun 30 08:04:07 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.