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

memory error when linking host prototypes

XMLWordPrintable

    • Sprint 75 (Apr 2021), Sprint 76 (May 2021)
    • 0.125

      The following scenario produces the following memory error:
      1) create template with the host prototype (custom or inherit interface)
      2) link template to a host
      3) unlink template (do not use unlink and clear)
      4) create autoregistration that adds host and links a new template
      5) update host metadata
      6) restart server and agent
      result:

      ==00:00:00:13.273 28263== Use of uninitialised value of size 8                                                                                                                                                                                                          
      ==00:00:00:13.273 28263==    at 0x77742DC: ____strtol_l_internal (strtol_l.c:292)                                                                                                                                                                                       
      ==00:00:00:13.273 28263==    by 0x776F7AF: atoi (atoi.c:27)                                                                                                                                                                                                             
      ==00:00:00:13.273 28263==    by 0x3A1935: DBhost_prototypes_make (host.c:2627)                                                                                                                                                                                          
      ==00:00:00:13.273 28263==    by 0x3A63EC: DBcopy_template_host_prototypes (host.c:4183)                                                                                                                                                                                 
      ==00:00:00:13.273 28263==    by 0x3AAC1D: DBcopy_template_elements (host.c:5582)                                                                                                                                                                                        
      ==00:00:00:13.273 28263==    by 0x27FF4A: op_template_add (operations.c:898)                                                                                                                                                                                            
      ==00:00:00:13.273 28263==    by 0x2754D7: execute_operations (actions.c:2876)                                                                                                                                                                                           
      ==00:00:00:13.273 28263==    by 0x27604D: process_actions (actions.c:3264)                                                                                                                                                                                              
      ==00:00:00:13.273 28263==    by 0x27C159: flush_events (events.c:2087)                                                                                                                                                                                                  
      ==00:00:00:13.273 28263==    by 0x27DB79: zbx_process_events (events.c:2804)                                                                                                                                                                                            
      ==00:00:00:13.273 28263==    by 0x39451C: DBregister_host_flush (db.c:1819)                                                                                                                                                                                             
      ==00:00:00:13.273 28263==    by 0x393645: DBregister_host (db.c:1505)                                                                                                                                                                                                   
      ==00:00:00:13.273 28263==  Uninitialised value was created by a heap allocation                                                                                                                                                                                         
      ==00:00:00:13.273 28263==    at 0x4C31B0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)                                                                                                                                                              
      ==00:00:00:13.273 28263==    by 0x4EA04CF: ??? (in /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20.3.20)                                                                                                                                                                 
      ==00:00:00:13.273 28263==    by 0x4E9E8AE: ??? (in /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20.3.20)                                                                                                                                                                 
      ==00:00:00:13.273 28263==    by 0x4E672BB: ??? (in /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20.3.20)                                                                                                                                                                 
      ==00:00:00:13.273 28263==    by 0x4E697D6: mysql_store_result (in /usr/lib/x86_64-linux-gnu/libmysqlclient.so.20.3.20)                                                                                                                                                  
      ==00:00:00:13.273 28263==    by 0x3C53D5: zbx_db_vselect (db.c:1621)                                                                                                                                                                                                    
      ==00:00:00:13.273 28263==    by 0x391F47: DBselect (db.c:495)                                                                                                                                                                                                           
      ==00:00:00:13.273 28263==    by 0x3A178B: DBhost_prototypes_make (host.c:2608)                                                                                                                                                                                          
      ==00:00:00:13.273 28263==    by 0x3A63EC: DBcopy_template_host_prototypes (host.c:4183)                                                                                                                                                                                 
      ==00:00:00:13.273 28263==    by 0x3AAC1D: DBcopy_template_elements (host.c:5582)                                                                                                                                                                                        
      ==00:00:00:13.273 28263==    by 0x27FF4A: op_template_add (operations.c:898)                                                                                                                                                                                            
      ==00:00:00:13.273 28263==    by 0x2754D7: execute_operations (actions.c:2876) 
      
      

      the error seems to be caused by the following line 2627 in host.c:

      [ZBXNEXT-6063] added custom interface support for host prototype                                                                                  
                                              if (host_prototype->custom_interfaces != (unsigned char)atoi(row[6]))                                                                                      
                                                      host_prototype->flags |= ZBX_FLAG_HPLINK_UPDATE_CUSTOM_INTERFACES; 
      

      which is reading the row[6] but it is not selected in the sql select above:

        "select i.itemid,h.hostid,h.host,h.name,h.status,h.discover"      
      

            asestakovs Aleksejs Sestakovs
            arimdjonoks Artjoms Rimdjonoks
            Team B
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: