FreeBSD pkg HOST-RESOURCES-MIB::hrSWInstalled stops working

Mark Felder <[email protected]>
Newsgroups gmane.network.net-snmp.devel
Message-ID <1525711499.3389567.1363633472.3DE8B0C7@webmail.messagingengine.com>
Hello all,

The HOST-RESOURCES-MIB::hrSWInstalled support for FreeBSD pkg stops working after so many queries and requires an snmpd process restart. I have been observing this for quite some time and have only recently started to debug it. The code in question is at:

agent/mibgroup/host/data_access/swinst_pkginfo.c

When debugging I see it throw either:

snmp_log( LOG_ERR, "SWInst: error initializing pkgng db\n" );

or

snmp_log( LOG_ERR, "SWInst: error opening pkgng db\n" );

neither of which should be true as nothing on the system changes. After seeing one of these for a few times there are no further messages at which point I believe it's having issues before it hits 

    /* if we are using FreeBSD's pkgng */
    if (pkgng) {
        if ((it = pkgdb_query(db, NULL, MATCH_ALL)) == NULL) {
            snmp_log( LOG_ERR, "SWInst: error querying pkgng db\n" );
            return 1;
        }


It seems that if the system has fewer packages installed it can be queried more times before it stops working. I was able to reproduce the issue every time at 19 queries on one test host.

Could anyone provide any possible insight or ideas on what could be the issue here? I have compared the code with that used internally in FreeBSD pkg tool and it's nearly identical. The only thing that I felt was missing was declaring a readonly lock on the database but even adding that into the snmp code had no effect...


Thanks


-- 
  Mark Felder
  ports-secteam & portmgr member
  [email protected]

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.