Bug 209368 - [PATCH] bsnmpd: snmp_hostres: Only refresh devtree if devd event is a new or removed device
Summary: [PATCH] bsnmpd: snmp_hostres: Only refresh devtree if devd event is a new or ...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.0-STABLE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-bugs mailing list
URL:
Keywords: patch
: 215471 217983 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-05-07 20:22 UTC by Joe Marcus Clarke
Modified: 2018-05-14 17:15 UTC (History)
11 users (show)

See Also:


Attachments
Only refresh device table on a device add or remove event (404 bytes, patch)
2016-05-07 20:22 UTC, Joe Marcus Clarke
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Marcus Clarke freebsd_committer 2016-05-07 20:22:03 UTC
Created attachment 170101 [details]
Only refresh device table on a device add or remove event

In a recent update of 10-STABLE, devd began spewing:

!system=CAM subsystem=periph type=error device=cd0 serial="10000000000000000001" cam_status="0xcc" scsi_status=2 scsi_sense="70 02 3a 00" CDB="00 00 00 00 00 00 " 

This caused bsnmpd to take up nearly 100% of the CPU refreshing the devtree table every second.  Admittedly, this is an issue in the CAM driver, but why refresh the whole tree each time a device is not either inserted or removed?

The attached patch corrects this by only refreshing the devtree when a device is added or removed.
Comment 1 Florian Smeets freebsd_committer 2016-07-09 08:56:14 UTC
I saw this on head and stable/11. Can we get this patch in, and make sure it's MFC'ed to stable/10 and stable/11 before 11.0-RELESE?
Comment 2 Pedro F. Giffuni freebsd_committer 2016-07-25 02:12:25 UTC
I think ngie is working on bsnmpd.
Comment 3 Remko Lodder freebsd_committer 2016-08-30 06:29:55 UTC
I can confirm that this happends on RC2 (but it does not seem to occur on RC1) for FreeBSD 11.

After upgrading to RC2 somehow cd0 is noticed and is constantly getting queried. This generates high bsnmp load, and somehow it ran out of swap space on one of my machines yesterday (might be unrelated though).

I can easily see from the VPS vendor that the high cpu utilization started after upgrading to -RC2.
Comment 4 emz 2016-10-25 06:45:04 UTC
Please commit it, bsnmpd isn't fully functional without it (and what is the point of running SNMP daemon without host resourses module ?).

I was having problems with bsnmpd (answering to the snmpwalk like once per 10 requests), but after installing it bsnmpd seems to be working fine.
Comment 5 Nick Hilliard 2017-10-23 19:39:27 UTC
This is still a problem on freebsd 11.1 running under xen.  Could someone commit this patch please?
Comment 6 commit-hook freebsd_committer 2017-10-28 21:27:50 UTC
A commit references this bug:

Author: pfg
Date: Sat Oct 28 21:26:49 UTC 2017
New revision: 325067
URL: https://svnweb.freebsd.org/changeset/base/325067

Log:
  bsnmpd: Only refresh devtree if devd event is a new or removed device.

  It makes sense to refresh the tree only when a device is inserted or
  removed, otherwise bsnmpd wastes lot of CPU.

  PR:		209368
  MFC after:	1 week

Changes:
  head/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c
Comment 7 commit-hook freebsd_committer 2017-11-04 14:50:19 UTC
A commit references this bug:

Author: pfg
Date: Sat Nov  4 14:49:22 UTC 2017
New revision: 325395
URL: https://svnweb.freebsd.org/changeset/base/325395

Log:
  MFC r325067:
  bsnmpd: Only refresh devtree if devd event is a new or removed device.

  It makes sense to refresh the tree only when a device is inserted or
  removed, otherwise bsnmpd needlessly wastes lots of CPU.

  PR:		209368

Changes:
_U  stable/11/
  stable/11/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c
Comment 8 commit-hook freebsd_committer 2017-11-04 14:57:29 UTC
A commit references this bug:

Author: pfg
Date: Sat Nov  4 14:56:58 UTC 2017
New revision: 325396
URL: https://svnweb.freebsd.org/changeset/base/325396

Log:
  MFC r325067:
  bsnmpd: Only refresh devtree if devd event is a new or removed device.

  It makes sense to refresh the tree only when a device is inserted or
  removed, otherwise bsnmpd needlessly wastes lots of CPU.

  PR:		209368

Changes:
_U  stable/10/
  stable/10/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_device_tbl.c
Comment 9 Pedro F. Giffuni freebsd_committer 2017-11-04 15:10:31 UTC
Committed all the way to 10-stable
Comment 10 Conrad Meyer freebsd_committer 2018-05-14 17:15:35 UTC
*** Bug 217983 has been marked as a duplicate of this bug. ***
Comment 11 Conrad Meyer freebsd_committer 2018-05-14 17:15:40 UTC
*** Bug 215471 has been marked as a duplicate of this bug. ***