Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-12179

Database errors can go unnoticed with DBselect(), DBfetch() functions

    XMLWordPrintable

    Details

    • Type: Problem report
    • Status: Confirmed
    • Priority: Trivial
    • Resolution: Unresolved
    • Affects Version/s: 2.0.21, 2.2.18, 3.2.6, 3.4.0alpha1
    • Fix Version/s: None
    • Component/s: Proxy (P), Server (S)
    • Labels:
    • Team:
      Team C
    • Sprint:
      Sprint 15, Sprint 16, Sprint 17, Sprint 18, Sprint 19, Sprint 20
    • Story Points:
      26

      Description

      1. DBselect() blocks if database is down, but may return NULL in case of other errors.
      In many functions there are correct checks like "if (NULL == (result = DBselect(....)", that is good.
      In some functions DBselect() result is passed directly to DBfetch() in a code like this:
      "if (NULL == (row = DBfetch(result))" or "while (NULL != (row = DBfetch(result)))".
      In these cases a database error is masked as "no (more) records found", which may cause errors in program logic. This was the root cause of ZBX-12046. Another example is get_value_internal(), which will return 0 as a value instead of NOTSUPPORTED in case of DB error.
      2. Alexander Vladishev pointed out a similar problem with DBfetch().
      In case of Oracle DB the DBfetch() retrieves data in chunks from server. If a database error occurs, DBfetch() returns NULL, interpreted as "no (more) records found", which may not always be true.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              zabbix.dev Zabbix Development Team
              Reporter:
              andris Andris Mednis
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated: