Uploaded image for project: 'MariaDB Foundation Development'
  1. MariaDB Foundation Development
  2. MDBF-1149

Make Zabbix Calls Non-Blocking

    XMLWordPrintable

Details

    Description

      Background

      The Zabbix Python module performs synchronous API calls, which block the reactor’s event loop and can potentially cause the master to freeze.
      Even worse, the configured timeout can block execution for up to 10 seconds.

      After reviewing the official integration documentation (https://www.zabbix.com/integrations/python), I concluded that no Twisted-compatible module exists that allows asynchronous API calls.

      Writing such a module from scratch would be excessive for such a small component.
      Since no Twisted integration is available,
      I also see no benefit in switching to a different Zabbix module; the current one has served us well.

      Changes

      The solution is to run the synchronous code in a separate thread by passing getMetric to deferToThread.
      This prevents the main thread from being blocked.

      The critical section is wrapped in a try/except block to ensure that any failure inside getMetric,
      for example, Zabbix unavailability, missing metrics, or network issues, does not prevent the build from starting.

      I also reduced the timeout to 3 seconds.

      Although the main thread is no longer blocked, Buildbot’s BuildRequestDistributor will not proceed to the next builder’s build request until canStartBuild has completed.
      Reducing the timeout prevents unnecessary delays in processing the build request queue

      Attachments

        Activity

          People

            rvarzaru Varzaru Razvan-Liviu
            rvarzaru Varzaru Razvan-Liviu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0d
                0d
                Logged:
                Time Spent - 2d
                2d