Intermittent API error -32500 (SQL failed) due to FK constraint on permission table during parallel provisioning

XMLWordPrintable

    • S26-W10/11, S26-W12/13, S26-W14/15
    • 5
    • 1

      We are experiencing intermittent -32500 (SQL failed) errors via the API when running parallel provisioning scripts and JIT AD syncing. Currently, this issue is impacting a client's environment with over 1,000 users.

      While initially thought to be exclusively related to host.create, we observed this happening with user provisioning/updates as well ("cannot add/update user").

      The issue seems to be a race condition highly similar to the logic discussed in ZBX-27448. When multiple parallel processes attempt to create entities with uniquely new host-group/user-group combinations, the processes attempt to "reserve" the same future IDs for the new group-set's hash. This results in a clash during insertBatch() within createHgSets(), ultimately failing when inserting related records into the permission table because the parent hgset record hasn't been successfully committed yet.

      The API intermittently returns a -32500 (SQL failed) error.

      Looking at the frontend debug logs (API response debug), the following foreign key constraint failure is exposed:

      cannot add or update a child row: a foreign key constraint fails (`zabbix`.`permission`, CONSTRAINT `c_permission_2` FOREIGN KEY (`hgsetid`) REFERENCES `hgset` (`hgsetid`) ON DELETE CASCADE)

            Assignee:
            Janis Freibergs
            Reporter:
            Lucas Frade
            Team C
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 29.5h
                29.5h