Skip to contentSkip to conversation

Slow SNMP daemon startup

Buildroot Grant Edwards 1 participant 3 messages Dec 15, 2020

lore
Share & tools
lore
#0 lore raw

After upgrading from an older version of net-snmp (5.7.3 -> 5.8) it now takes the snmp daemon anywhere from 5s to a minute to start up. It used to start with no noticeable delay.

Has anybody else noticed this?

Does anybody have any guesses on where to start looking for the problem?

There's nothing in the syslog to indicate any problem:

 # grep snmp /var/log/messages
 Jan  1 00:00:08 (none) daemon.info snmpd[944]: Created directory: /var/lib/snmp
 Jan  1 00:00:08 (none) daemon.info snmpd[944]: Created directory: /var/lib/snmp/cert_indexes
 Dec 15 15:17:26 (none) daemon.info snmpd[944]: Created directory: /var/lib/snmp/mib_indexes
 Dec 15 15:17:26 (none) daemon.info snmpd[946]: NET-SNMP version 5.8

Though it looks like the ntp daemon has stepped the time while snmpd is starting up, so perhaps that's causing a problem...

--
Grant

#1 lore raw
Quoted 10 lines · Grant Edwards

After upgrading from an older version of net-snmp (5.7.3 -> 5.8) it now takes the snmp daemon anywhere from 5s to a minute to start up. It used to start with no noticeable delay.

Has anybody else noticed this?

Does anybody have any guesses on where to start looking for the problem?

There's nothing in the syslog to indicate any problem:

Quoted 8 lines
 # grep snmp /var/log/messages
 Jan  1 00:00:08 (none) daemon.info snmpd[944]: Created directory: /var/lib/snmp
 Jan  1 00:00:08 (none) daemon.info snmpd[944]: Created directory: /var/lib/snmp/cert_indexes
 Dec 15 15:17:26 (none) daemon.info snmpd[944]: Created directory: /var/lib/snmp/mib_indexes
 Dec 15 15:17:26 (none) daemon.info snmpd[946]: NET-SNMP version 5.8

Though it looks like the ntp daemon has stepped the time while snmpd is starting up, so perhaps that's causing a problem...

That's not it. I disable ntp, and it got even worse (over two minutes):

   # grep snmp /var/log/messages
   Jan  1 00:00:08 (none) daemon.info snmpd[942]: Created directory: /var/lib/snmp
   Jan  1 00:00:08 (none) daemon.info snmpd[942]: Created directory: /var/lib/snmp/cert_indexes
   Jan  1 00:02:34 (none) daemon.info snmpd[942]: Created directory: /var/lib/snmp/mib_indexes
   Jan  1 00:02:34 (none) daemon.info snmpd[944]: NET-SNMP version 5.8

--
Grant

#2 lore raw
Quoted 4 lines · Grant Edwards
Quoted 2 lines · Grant Edwards

After upgrading from an older version of net-snmp (5.7.3 -> 5.8) it now takes the snmp daemon anywhere from 5s to a minute to start up.

If there's no network traffic, it can take _several_minutes_ for snmpd to start. This makes one suspect a lack of entropy, and strace confirms that:

00:00:09 gettimeofday({9, 266859}, NULL) = 0
00:00:09 futex(0x4044bc3c, FUTEX_WAKE_PRIVATE, 2147483647) = 0
00:00:09 getrandom(0x3f830, 32, 0) = -1 ENOSYS (Function not implemented)
00:00:09 shmget(0x72, 1, 000) = -1 ENOENT (No such file or directory)
00:00:09 uname({sysname="Linux", nodename="grant-eip-4", ...}) = 0
00:00:09 open("/dev/random", O_RDONLY|O_LARGEFILE) = 9
00:00:09 _newselect(10, [9], NULL, NULL, NULL) = 1 (in [9])
00:01:23 close(9) = 0
00:01:23 shmget(0x72, 1, IPC_CREAT|0444) = 0
00:01:23 shmat(0, NULL, SHM_RDONLY) = 0x4000a000
00:01:23 open("/dev/urandom", O_RDONLY|O_LARGEFILE) = 9
00:01:23 fstat64(9, {st_mode=S_IFCHR|0660, st_rdev=makedev(1, 9), ...}) = 0
00:01:23 read(9, "\330\3311\376\346\213\362\5Ib\365\347*BS\354\351\375\t<\346\310\24C\254\365h\330-.\372\230", 32) = 32 00:01:23 gettimeofday({83, 792926}, NULL) = 0

Why do application developers consider this acceptable behavior?

--
Grant